题目连接:http://acm.zznu.edu.cn/problem.php?id=1329

题目大意:

定理:把一个至少两位的正整数的个位数字去掉,再从余下的数中减去个位数的5倍。当且仅当差是17的倍数时,原数也是17的倍数 。

例如,34是17的倍数,因为3-20=-17是17的倍数;201不是17的倍数,因为20-5=15不是17的倍数。输入一个正整数n,判断n是否能被17整除

代码:

#include<stdio.h>
#include<string.h>
#define N 1010

int main()
{
int i, x;
char s[N];
while(scanf("%s", s), strcmp(s, "0"))
{
x = 0;
for(i = 0 ; s[i] != '' ; i++)
{
x = x * 10 + (s[i] - '0');
if(x > 17)
x %= 17;
}
if(x % 17 == 0)
printf("1 ");
else
printf("0 ");
}
return 0;
}//大数取余可以用这种方法处理

原文地址:https://www.cnblogs.com/qq2424260747/p/4436449.html