Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 33777 | Accepted: 13157 |
Description
``This supercomputer is great,'' remarked Chip. ``I only wish Timothy were here to see these results.'' (Chip moved to a new apartment, once one became available on the third floor of the Lemon Sky apartments on Third Street.)
Input
The final input line will contain a single zero on a line by itself.
Output
Sample Input
123456789012345678901234567890 123456789012345678901234567890 123456789012345678901234567890 0
Sample Output
370370367037037036703703703670題目和代碼都不難就不多說直接看代碼吧
#include
#include
#define MAXN 105
int b[MAXN];
char a[MAXN];
int main(){
int len,i,j,k;
while(scanf("%s",a)!=EOF){
if(strcmp(a,"0")==0){
break;
}
else{
len=strlen(a);
for(i=0;i=10){
b[j+1]=b[j+1]+b[j]/10;
b[j]=b[j]%10;
}
}
}
}
k=MAXN;
while(b[--k]==0);
while(k>=0){
printf("%d",b[k--]);
}
}