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 |
数据通过为什么????Wrong answer!!!!!!!!!!!# include<iostream.h> # include<stdlib.h> int comp(const void*a,const void*b) { return *(double *)a > *(double *)b ? 1 : -1; } int main() { int f; int r; double ff[10]; double rr[10]; double s[100]; double R[100]; int i,j; int k,b; while(1) { cin>>f ; if(f==0) break; cin>>r; for(i=0;i<f;i++) { cin>>ff[i]; } for(j=0;j<r;j++) { cin>>rr[j]; } for(k=0;k<f*r;) { for(i=0;i<f;i++) { for(j=0;j<r;j++) { s[k]= rr[j]/ff[i]; k++; } } } qsort(s,r*f-1,sizeof(double),comp); for( k=0;k<f*r;) { for(i=1;i<f*r;i++) { R[k]=s[i]/s[i-1]; k++; } } qsort(R,r*f,sizeof(double),comp); cout.setf(ios::fixed); cout.precision (2); cout<<R[f*r-1]<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator