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 08063102 at 2011-07-21 13:11:03 on Problem 2562
#include<stdio.h>
#include<string.h>
main()
{
 int i,n,j;
 char a[9],b[9];
 while(scanf("%s%s",&a,&b)&&((a[0]-'0')||(b[0]-'0')))
 {
  if(strlen(b)<10&&strlen(a)<10)
  {
    n=0;
 	for(i=(strlen(a)-1);i>=0;i--)
 	{
 		j=(strlen(b)-1);
	  if((j<0)||(i<0))
		break;
       if((a[i]-'0')+(b[j]-'0')>=10)
	   {    
            n++;
            a[i-1]=a[i-1]+'1';
	   }
	 j--;
		 
    }
    if(n==0)    
    {
     printf("No carry operation.\n");	
    }
    else if(n==1)
    printf("%d carry operation.\n",n);
    else
    printf("%d carry operations.\n",n);
  } 
  else
  break;
 }
}

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