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 inthinker at 2007-07-29 08:58:02 on Problem 3300
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
int front,rear;
double a[10],b[10];
int i,j;
vector<double> v;
vector<double> v2;
while(1){
   cin>>front;
   if(front==0)return 0;
   cin>>rear;
   for(i=0;i<front;i++)
    cin>>a[i];
   for(j=0;j<rear;j++)
    cin>>b[j];
   for(i=0;i<front;i++){
    for(j=0;j<rear;j++){
     double temp;
     temp=b[j]/a[i];
     v.push_back(temp);
    }
   }
   sort(v.begin(),v.end());

   vector<double>::iterator it;
   for(it=v.begin()+1;it!=v.end();it++){
    double temp2;
    double t1,t2;
    t1=*it;
    t2=*(it-1);
    temp2=t1/t2;
    v2.push_back(temp2);
   }
   sort(v2.begin(),v2.end());

   printf("%.2f\n",*(v2.end()-1));
}
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