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 IC0590501123 at 2005-12-30 11:28:02 on Problem 1519
#include <stdio.h>
long abc(long n)
{
	long m,k,j;
		m=n%10;
		k=n-m;
		j=m;
		do
		{
			n=k/10;
			m=n%10;
			j=j+m;
			k=n-m;
		}while(k>0);
		return(j);
}

void main()
{
	long n;
	scanf ("%d",&n);
	while(n!=0)
	{
		n=abc(n);
		while(n>=10)
			n=abc(n);
		printf("%d\n",n);
		scanf("%d",&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