| ||||||||||
| 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 i, j, m;
for( i=1; i< 10000; i++){
bool Is = true;
if(i<10)
m = 1;
else if(i<100)
m = (i-18 >0) ? i-18 : 1;
else if(i<1000)
m = i-27;
else
m = i-36;
for( j = m; j < i; j++)
if(j+j%10+(j/10)%10+(j%1000)/100+j/1000==i){
Is = false;
break;
}
if(Is == true)
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