#include<cstdio> #include<string.h> using namespace std; int main() { char n[111]; while (scanf("%s",n)!=EOF) { int l=strlen(n); if (l==1 && n[0]=='0') return 0; int r=0; for (int i=0;i<l;i++) { r=r*10+n[i]-'0'; r=r%17; } if (r==0) printf("1\n"); else printf("0\n"); } return 0; }
Thursday, April 28, 2016
UVA 11879 : Multiple of 17 - solution
Unknown
Studying at Shahjalal University of Science and Technology, Sylhet.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment