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 dlx at 2006-10-17 12:42:59 on Problem 1519
为什么会是超时呢,不应该有死循环啊.
大侠们帮帮看看哪错了?

#include<iostream.h>
void main()
{
	int a[100],b,c,i,temp,n;
	i=0;
	cin>>a[i];
	while(a[i])
	{
		i++;
		cin>>a[i];
	}
	n=i;
	
	for(i=0;i<n;i++)
	{
		c=a[i];
		do
		{
			if(!(c/10)){b=c;break;}
			b=c/10+c%10;
			c=b;
		}while(a[i]%b);
		cout<<b<<endl;
	}
}

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