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 }