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

大侠们帮帮忙啊,测试数据都过了为何还老是wa(附代码)

Posted by F1 at 2006-10-03 18:23:51 on Problem 2707
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	vector<int> vi_rate;
	for(int a,b,c,d;cin>>a>>b>>c>>d&&a&&b&&c&&d;)
	{
		int l1,w1,l2,w2;
		l1=a>b?a:b;
		w1=a<=b?a:b;
		l2=c>d?c:d;
		w2=c<=d?c:d;
		double r;
		if(l1<=l2&&w1<=w2) 
			   r=100;
	    if(l1>l2&&w1<=w2)
			   r=int((l2*1.0/l1<w1*1.0/w2?l2*1.0/l1:w1*1.0/w2)*100);
        if(l1<=l2&&w1>w2)
               r=int((l1*1.0/l2<w2*1.0/w1?l1*1.0/l2:w2*1.0/w1)*100);
		if(l1>l2&&w1>w2)
			   r=int((l2*1.0/l1<w2*1.0/w1?l2*1.0/l1:w2*1.0/w1)*100);
		vi_rate.push_back(r);
	}
	for(int i=0;i<vi_rate.size();++i)
		cout<<vi_rate[i]<<"%"<<endl;
	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