| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:没道理呀!!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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator