#include<string.h>
int main()
{
long long int b, i, t, test, remin, n, len, x, start;
char str[200];
scanf("%d",&test);
getchar();
for(t=1; t<=test; t++)
{
memset(str,'\0',sizeof(str));
start=0;
scanf("%s",str);
scanf("%lld",&b);
if(b<0)
b=b*(-1);
if(str[0]=='-')
start=1;
len=strlen(str);
x=0;
n=0;
for(i=start; str[i]!='\0'; i++)
{
x=(str[i]-'0')+x;
remin=x%b;
x=remin*10;
if(remin==0&&i==(len-1))
{
n++;
printf("Case %lld: divisible\n",t);
}
}
if(n==0)
{
printf("Case %lld: not divisible\n",t);
}
}
return 0;
}
No comments:
Post a Comment