http://www.bnuoj.com/v3/contest_show.php?cid=7612#info
http://www.bnuoj.com/v3/contest_show.php?cid=7612#problem/
题解:http://bestcoder.hdu.edu.cn/blog/2015-multi-university-training-contest-7-solutions-by-uestc/
水题:
#include <iostream> #include<stdio.h> using namespace std; int sum,x; void get_sum(int n) { while(n) { sum += n%10; n /= 10; } } void get_x() { int times = 1; int s = sum; while(s) { s /= 10; times *= 10; } x = (x * times)+sum; x = x%11; } int main() { int n,t; int cas = 1; while(cin>>n>>t && (n!=-1||t!=-1)) { sum = 0; x = 0; x = n%11; get_sum(n); for(int i = 1;i <= t;i ++){ get_x(); get_sum(sum); } if(x == 0) printf("Case #%d: Yes ",cas++); else if(x) printf("Case #%d: No ",cas++); } return 0; }