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 |
小弟新手求救!!!Output Limit Exceeded#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator