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

Re:我的代码

Posted by liuxun at 2011-07-30 13:45:53 on Problem 1183
In Reply To:我的代码 Posted by:074100215 at 2009-12-11 18:28:09
> 我考虑的是b,c其中一个肯定不大于2*a,b和c相差越少越好,所以从2*a开始找能整除的,找到就是相差差最少的,也就是和最小的
> 
> #include <stdio.h>
> #include <cmath>
> 
> int main()
> {
> __int64 a,b,c;
> while(scanf("%I64d",&a)!=EOF)
> {
>  b=2*a;
>  while((a*b+1)%(b-a)!=0) b--;
>  c=(a*b+1)/(b-a);
>  c=b+c;
>  printf("%I64d\n",c);
> }
> 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