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

Re:没道理呀!!

Posted by bujh36 at 2006-08-31 09:25:11 on Problem 2562
In Reply To:Re:没道理呀!! Posted by:2003011475 at 2006-05-30 15:46:51
那我这个呢

#include <iostream.h>
void main(void)
{
	unsigned int a,b;
	int i;
	cin>>a>>b;
	while(a!=0&&b!=0)
	{
		int count=0,flag=0;
		for(i=1;i<=11;i++)
		{
			if(a==0&&b==0)
				break;
			if(flag==1)
				if((a%10+b%10+1)>=10)
				{
					++count;
					flag=1;
				}
				else
					flag=0;
			else
				if((a%10+b%10)>=10)
				{
					++count;
					flag=1;
				}
				else
					flag=0;
			a/=10;
			b/=10;
		}
		if(count==0)
			cout<<"No carry operation."<<endl;
		else
			if(count==1)
				cout<<count<<" carry operation."<<endl;
			else
				cout<<count<<" carry operations."<<endl;
		cin>>a>>b;
	}
}

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