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

我的程序: long是不行的,一定要unsigned long

Posted by mai at 2004-11-11 22:36:34 on Problem 1183
#include <stdio.h>
#include <iostream.h>

int main () { 
	
	unsigned long i, a, b, min;
	
	cin >> a;
	
	min = a*a+2*a+2;
	
	for ( i=2*a; i>a; i-- ) {
		
		if ( (a*a+1)%(i-a) == 0 ) {
			
			b = i+a+(a*a+1)/(i-a);
			if ( b < min ) min = b;
			else break;
		}
	}

	cout << min << 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