AC代码(模拟大数取余)
Select Code
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
std::ios::sync_with_stdio(false);
char a[1000+10];
int i;
while(cin>>a)
{
int sum = 0;
int n = strlen(a);
if(n==1&&a[0] == '0')
break;
else
{
for(i = 0; i<n; i++)
{
sum = sum*10+a[i]-'0';
if(sum>=11)
sum%=11;
}
if(sum==0)
printf("%s is a multiple of 11.\n",a);
else
printf("%s is not a multiple of 11.\n", a);
}
}
return 0;
}