| ||||||||||
| 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 | |||||||||
还是WA阿。。。。。。。。In Reply To:Re:1183算法请教 Posted by:00130004 at 2003-07-22 14:59:44 > 算法没错,注意范围。
> 60000^2+1=3600000001>2^31。
>
#include <iostream.h>
#include <math.h>
void main(){
int a;
__int64 temp,b,c;
cin >> a;
temp=a*a+1;
for(__int64 i=a; i>0; i--){
if(temp%i == 0) {b=i;
c=temp/i;
break;}
}
cout <<int(a*2+b+c) << endl;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator