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

果断推倒

Posted by hustcswgy at 2011-07-29 15:36:53 on Problem 1183
(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:
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