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

小弟新手求救!!!Output Limit Exceeded

Posted by mao19880106 at 2008-09-07 19:41:47 on Problem 1519
#include<iostream>
using namespace std;
int main()
{

	for(int i=0;;i++)
	{
		int p;
		cin>>p;
		if(p==0)
		{
			break;
		}
		else
		{
	
		while(p>=10)
		{
			int temp=0;
		while(p%10||p/10)
		{
			temp=temp+p%10;
			p=p/10;
		}
		p=temp;
		}
		
		cout<<p<<endl;
		}
	}
	return 0;
}

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