Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

实际不用这么繁...

Posted by sza at 2006-02-10 14:48:48 on Problem 2562
In Reply To:求救,为什么啊WA Posted by:xiaoha at 2005-08-15 14:54:57
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
    unsigned int a,b;
    int c,i,counter;
    while(1){
        counter=0;
        scanf("%ld%ld",&a,&b);
        if(a==0&&b==0) break;
        c=0;
        while(1){
            if(a==0&&b==0) break;
            c=(a%10+b%10+c)/10;
            if(c>0) counter++;
            a=a/10;b=b/10;
        }
        if(counter==0) printf("No carry operation.\n");
        else{if(counter>1) printf("%d carry operations.\n",counter);
        else{printf("%d carry operation.\n",counter);}}
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator