PersonalCorpus 版 (精华区)

1234107 Big Guava ... 10035 Accepted
0:00.059 64 2002/11/13 11:34:23.167


void main()
{
#ifndef ONLINE_JUDGE
    freopen("k:\\uva\\i10035","r",stdin);
    freopen("k:\\uva\\o10035","w",stdout);
#endif

    int i,j,k,n,b1,b2;
    char s[13],t[13];


    while (1) {
        scanf("%d%d\n",&b1,&b2);
        if (!b1&&!b2) break;
        memset(s,0,sizeof(s));
        memset(t,0,sizeof(t));
        i=0;
        while (b1) {
            s[i++]=b1%10;
            b1/=10;
        }
        i=0;
        while (b2) {
            t[i++]=b2%10;
            b2/=10;
        }
        k=0; n=0;
        for (i=0;i<13;i++) {
            s[i]+=t[i]+k;
            if (s[i]>9) {
                n++;
                k=1;
            } else k=0;
        }
        if (n>1) printf("%d carry operations.\n",n);
        else if (n==1) printf("1 carry operation.\n");
        else printf("No carry operation.\n");
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.912毫秒