#include<stdio.h>
#include<string.h>
int main()
{
char an[110];
int i, j, n, m, l, c, a, b, d;
n = 10;
while(n--)
{
a = b = c = i = j = l = 0;
scanf("%s", an);
m = strlen(an);
while(an[j] == 48)
{
j++;
}
if(j == m)
{
break;
}
l = m-1;
while(an[l] == 48)
{
l--;
}
while(c != 4 && l>=0)
{
a = an[l] - 48;
if(c == 1)
{
a = a * 10;
}
else if(c == 2)
{
a = a * 100;
}
if(c == 3)
{
a = a* 1000;
}
b = b + a;
c++;
l--;
}
for(i=l;i>=j;i--)
{
d = b%10;
b = b/10;
b = b - (d*5);
a = an[i] - 48;
a = a * 1000;
b = b + a;
}
if(b%17 == 0)
{
printf("1\n");
}
else
{
printf("0\n");
}
}
return 0;
}
#include<string.h>
int main()
{
char an[110];
int i, j, n, m, l, c, a, b, d;
n = 10;
while(n--)
{
a = b = c = i = j = l = 0;
scanf("%s", an);
m = strlen(an);
while(an[j] == 48)
{
j++;
}
if(j == m)
{
break;
}
l = m-1;
while(an[l] == 48)
{
l--;
}
while(c != 4 && l>=0)
{
a = an[l] - 48;
if(c == 1)
{
a = a * 10;
}
else if(c == 2)
{
a = a * 100;
}
if(c == 3)
{
a = a* 1000;
}
b = b + a;
c++;
l--;
}
for(i=l;i>=j;i--)
{
d = b%10;
b = b/10;
b = b - (d*5);
a = an[i] - 48;
a = a * 1000;
b = b + a;
}
if(b%17 == 0)
{
printf("1\n");
}
else
{
printf("0\n");
}
}
return 0;
}
Comments
Post a Comment