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 |
一直WA,不知道哪里错了,路过的大牛帮忙指点下,谢谢#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator