加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

1175:除以13

发布时间:2020-12-13 17:33:49 所属栏目:PHP教程 来源:网络整理
导读:传送门:http://ybt.ssoier.cn:8088/problem_show.php?pid=1175 ? 1175:除以13 时间限制: 1000 ms ??? ??? 内存限制: 65536 KB 提交数: 3377 ??? 通过数: 2109 【题目描述】 输入一个大于0的大整数N,长度不超过100位,要求输出其除以13得到的商和余数。 【

传送门:http://ybt.ssoier.cn:8088/problem_show.php?pid=1175

?

1175:除以13


时间限制: 1000 ms ??? ??? 内存限制: 65536 KB
提交数: 3377 ??? 通过数: 2109

【题目描述】

输入一个大于0的大整数N,长度不超过100位,要求输出其除以13得到的商和余数。

【输入】

一个大于0的大整数,长度不超过100位。

【输出】

两行,分别为整数除法得到的商和余数。

【输入样例】

2132104848488485

【输出样例】

164008065268345
0





高精除低精

 1 #include<iostream>
 2 #include<cstring>
 3 #define N 410
 4 using namespace std;
 5 string a;
 6 int as[N],yu,lena,ans[N],tot=0;
 7 int main(){
 8     cin>>a;
 9     lena=a.size();
10     for(int i=0;i<lena;i++)as[i]=a[i]-0;
11     for(int i=0;i<lena;i++){
12         ans[++tot]=(yu*10+as[i])/13;
13         yu=(yu*10+as[i])%13;
14     }
15     int l=1;
16     while(ans[l]==0&&l<tot)l++;
17     for(int i=l;i<=tot;i++)cout<<ans[i];
18     cout<<endl<<yu<<endl;
19 }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读