lightoj1214 大数取模模板

时间:2021-12-04 19:50:59
#include<bits/stdc++.h>
using namespace std;
#define maxn 300
#define ll long long
ll a,b;
char s[];
inline ll calc(int i){
return s[i]-'';
}
int main(){
int T;
cin>>T;
for(int tt=;tt<=T;tt++){
cin>>s>>b;
b=abs(b);
a=; int len=strlen(s);
int i=;
if(s[]=='-')i=;
for(i;i<len;i++)
a*=,a+=(ll)calc(i),a%=b;
if(a==)
printf("Case %d: divisible\n",tt);
else printf("Case %d: not divisible\n",tt);
}
}