LightOJ1214 Large Division

 1 /*
 2  LightOJ1214 Large Division 
 3  http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1214
 4 
 5  数论 同余定理
 6 
 7  题意:大整数取余
 8  *
 9  *
10  *
11  *
12  */
13 
14 
15 #include <cstdio>
16 #include <cstring>
17 using namespace std;
18 char s[205];
19 int main()
20 {
21     int t;
22     scanf("%d",&t);
23     long long b;
24     for(int i=1;i<=t;i++)
25     {
26         printf("Case %d: ",i);
27         getchar();
28         scanf("%s",s);
29         scanf("%lld",&b);
30         int n=strlen(s);
31         long long num=0LL;
32         for(int i=0;i<n;i++)
33         {
34             if(s[i]=='-')
35                 continue;
36             num=(num*10LL+s[i]-'0')%b;
37         }
38         if(num==0LL)
39             printf("divisible\n");
40         else
41             printf("not divisible\n");
42     }
43     return 0;
44 }

 

转载于:https://www.cnblogs.com/BBBob/p/6556208.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值