| ||||||||||
| 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:floor(temp*100)时会出现结果0%In Reply To:WA?请帮忙看一下. Posted by:zcxiao at 2006-07-10 10:01:57 > #include <iostream>
> #include <math.h>
> using namespace std;
> int main()
> {
> float x1,y1,x2,y2,temp;
> cin>>x1>>y1>>x2>>y2;
> while(x1||y1||x2||y2)
> {
> if(x1<y1) {temp=x1;x1=y1;y1=temp;}
> if(x2<y2) {temp=x2;x2=y2;y2=temp;}
> temp=float(x2/x1)>float(y2/y1)?float(y2/y1):float(x2/x1);
> if(temp>=1) temp=1;
> else if(temp<0.01) temp=0.01;
> cout<<floor(temp*100)<<"%"<<endl;
> cin>>x1>>y1>>x2>>y2;
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator