PersonalCorpus 版 (精华区)
39618 2002-10-07 21:23:39 Accepted
1205 C++ 00:00.00 384K Big Guava
static char p[21]="0123456789abcdefghij";
int main()
{
#ifndef ONLINE_JUDGE
freopen("c:\\0acm\\zju\\i1205","r",stdin);
freopen("c:\\0acm\\zju\\o1205","w",stdout);
#endif
char s[200];
int i,j,k,l;
int a[105],b[105];
while (gets(s)!=NULL) {
memset(a,0,sizeof(a));
j=strlen(s)-1;
for (i=j;i>=0;i--)
if ((s[i]>='a')&&(s[i]<='j')) a[j-i]=s[i]-87; else
a[j-i]=s[i]-48;
gets(s);
memset(b,0,sizeof(b));
j=strlen(s)-1;
for (i=j;i>=0;i--)
if ((s[i]>='a')&&(s[i]<='j')) b[j-i]=s[i]-87; else
b[j-i]=s[i]-48;
k=0;
for (i=0;i<105;i++) {
b[i]+=k;
b[i]+=a[i];
k=b[i]/20;
b[i]%=20;
}
for (i=104;i>0;i--) if (b[i]!=0) break;
for (;i>=0;i--) printf("%c",p[b[i]]);
printf("\n");
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.736毫秒