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:怎么总过不了啊 我用的是double啊 高手帮忙看看啊

Posted by Cathy11 at 2008-03-19 13:56:54 on Problem 2707
In Reply To:怎么总过不了啊 我用的是double啊 高手帮忙看看啊 Posted by:dzs8819 at 2007-04-22 16:24:48
>",(int)(min(x,y)*100));这样好象有问题的,我直接把x,y定义成int就ac了
#include<stdio.h>
> double max(double x,double y)
> {
>     if(x>y)
>         return x;
>     else
>         return y;
> }
> 
> double min(double x,double y)
> {
>     if(x<y)
>         return x;
>     else
>         return y;
> }
> 
> int main()
> {
>     double a,b,c,d,x,y;
>     while(scanf("%lf%lf%lf%lf",&a,&b,&c,&d) && a!=0 && b!=0 && c!=0 && d!=0)
>     {
>         if(max(a,b)<=max(c,d) && min(a,b)<=min(c,d))
>             printf("100%%\n");
>         else
>         {
>             x=max(c,d)/max(a,b);
>             y=min(c,d)/min(a,b);
>             printf("%d%%\n",(int)(min(x,y)*100));
>         }
>     }
>     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