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

怎么还是会wa?都注意到了啊……

Posted by youngercool at 2007-05-07 16:33:55 on Problem 2562
#include "stdio.h"
#include "math.h"

main()
{
	int i, counter, t;
	long int a, b;
	while (scanf ("%ld %ld", &a, &b)&&(a||b))
	{
		t=0;
		counter=0;
		for (i=0; i<10; i++)
		{
			if (a/(int)(pow(10,i))%10+b/(int)(pow(10,i))%10+t>9)
			{
				counter++;
				t=1;
			}
			else
			{
				t=0;
			}
		}
		if (counter)
		{
			if (counter>1)
			{
				printf ("%d carry operations.\n", counter);
			}
			else
			{
				printf ("1 carry operation.\n");
			}
		}
		else
		{
			printf ("No carry operation.\n");
		}
	}
}

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