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 main() { int a[10001] = {0}; int num = 0; int n , m; int i , j = 0; for(i = 1 ; i < 10001; i++) { num = i; if(!a[i]) cout<<i<<endl; n = i; while( n ) { m = n % 10; num += m; n /= 10; } if(num < 10001) a[num] = 1; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator