直接模拟
#include#include #include #include #include #include #include #include #include #include #include #include #include #include #include
(x):(y)) using namespace std; void mys(int& res) { int flag=0; char ch; while(!(((ch=getchar())>='0'&&ch<='9')||ch=='-')) if(ch==EOF) res=INF; if(ch=='-') flag=1; else if(ch>='0'&&ch<='9') res=ch-'0'; while((ch=getchar())>='0'&&ch<='9') res=res*10+ch-'0'; res=flag?
-res:res; } void myp(int a) { if(a>9) myp(a/10); putchar(a%10+'0'); } /*************************THE END OF TEMPLATE************************/ int sum, cnt; int nod(int n){ int ans=0; w(n){ ++ans; n/=10; } return ans; } int ads(int n){ int ans=0; w(n){ ans += (n%10); n/=10; } return ans; } int mpow(int x){ int ans = 1; w(x--){ ans*=10; } return ans; } int main(){ int n, t, ws; int time=1; w(~ss(n, t) ){ if(t==-1 && n==-1) break; sum = n; cnt = ads(n); w(t--){ sum = sum % 11; sum = (mpow(nod(cnt))*sum + cnt); cnt = cnt + ads(cnt); } sum%=11; printf("Case #%d: ",time++); if(sum) puts("No"); else puts("Yes"); } return 0; }