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<cstdio> #include<cmath> using namespace std; int main() { __int64 a; __int64 x; __int64 i; scanf("%lld",&a); x=a+(int)sqrt((double)a*a+1); __int64 min=(a+1)*(a+1)+1; for(i=x; i>a+1; i--) { if((i*i+1)%(i-a)==0) { if((i*i+1)/(i-a)<min) min=(i*i+1)/(i-a); break; } } printf("%lld\n",min); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator