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

运行正常,但是答案错误,怎么办 by glut

Posted by laojichao at 2017-11-15 09:53:47 on Problem 2562
#include<iostream>
using namespace std;
int main()
{
	int x,y;
	while(cin>>x>>y&&x&y)
	{
		int count(0),sum(0);
		while(x&&y)
                {
			sum+=x%10+y%10;
			if(sum>9)
			{
				count++;
				sum=1;
			}
			else
				sum=0;
                x/=10;  
                y/=10;  
                }
		if(count)
		cout<<count<<" carry operations."<<endl;
		else
			cout<<"No carry operation."<<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