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

哪位大虾帮忙看看!!!!!为什么总是memory limit exceed?

Posted by burningice at 2003-12-14 19:05:55 on Problem 1519
#include<iostream.h>
void main()
{
	char num[100],*p;
	long n,m;
	cin>>num;
	p=num;
	while(*p!='0'){
		n=0;
		while(*p){
			n+=*p-'0';
			p++;
		}	
		while(n>=10){
			m=n;
			n=0;
			while(m>0){
				n+=m%10;
				m=m/10;
			}
		}
			cout<<n<<endl;
		cin>>num;
			p=num;
	}
}
		

		

		


	




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