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:floor(temp*100)时会出现结果0%

Posted by wsbear at 2006-07-22 16:14:56 on Problem 2707
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:
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