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

这种问题已经问过无数次了,建议hawk写在faq里吧

Posted by xiaomi at 2004-03-30 00:26:01 on Problem 1519
In Reply To:哪位大虾帮忙看看!!!!!为什么总是memory limit exceed? Posted by:burningice at 2003-12-14 19:05:55
> #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