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 |
我的程序: long是不行的,一定要unsigned long#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator