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 |
为什么用数组呢?#include <iostream> using namespace std; int qiu(int k) { int sum=0; while(k!=0) { sum+=k%10; k=k/10; } return sum; } int main(void) { int i=1; for(;i<10000;i++) { int j=1,sum=0; for(;j<i;j++) { sum=j; sum+=qiu(j); if(sum==i) break; } if(sum==i) continue; cout<<i<<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