Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

暴力法解决

Posted by jinian_08 at 2010-07-02 21:18:54 on Problem 1316
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator