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

程序就像妹子的迷你裙 越短越好……看我的性感423Byte程序

Posted by Sayakiss at 2010-07-01 13:14:15 on Problem 1079
In Reply To:很easy就解决了蛮。。放AC代码 Posted by:yzhw at 2009-06-19 21:15:53
# include<stdio.h>
# include<stdlib.h>
int i,p,q,pt,a,b;
int main()
{
    while (scanf("%d%d",&a,&b)!=-1)
    {
          p=1;q=0;
          for (i=1;i<=b;i++)
          {
              pt=(double)(i*a)/(double)b+0.5;
              if (q*abs(a*i-b*pt)<i*abs(a*q-b*p)) {p=pt;q=i;printf("%d/%d\n",p,q);}
              if (a*q==b*p) break;
          }
          printf("\n");
    }
    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