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 |
果断推倒(c-a)(b-a)=a^2+1 乘积为常数,两数越接近和越小。 #include<stdio.h> #include<math.h> int main() { double a, b; scanf("%lf", &a); for(b = floor(sqrt(a*a+1)); floor((a*a+1)/b) != (a*a+1)/b; b--); printf("%.0f\n", b + (a*a+1)/b + 2*a); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator