| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪位大虾帮忙看看!!!!!为什么总是memory limit exceed?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator