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
北京大学《ACM/ICPC大学生程序设计竞赛训练》暑期课面向全球招生!

郁闷!!我也WA了

Posted by oassuperhan at 2009-01-23 08:15:34 on Problem 2562
#include <iostream>
using namespace std;
int main()
{
    long long a,b,carry=0;
    while(cin>>a>>b&&(a&&b))
    {
        carry=0;
        while(a&&b)
        {
            if(a%10+b%10>9)
            {
                carry++;
                a+=10;
            }
            a/=10;b/=10;    
        }
        if(!carry)
        {
            cout<<"No carry operation."<<endl;
        }    
        else if(carry==1)
            cout<<"1 carry operation."<<endl;
        else cout<<carry<<" carry operations."<<endl;
    }
    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