| ||||||||||
| 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 | |||||||||
Re:怎么总过不了啊 我用的是double啊 高手帮忙看看啊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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator