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 |
求求各位牛人帮忙看看吧!谢谢了!!!!!!!!!!!#include<stdio.h> #include<iostream> #include<algorithm> using namespace std; int main() { int i,j,k,f,r; int a[10],b[10]; double c[101]; while(scanf("%d",&f)!=EOF&&f) { scanf("%d",&r); for(i=0;i<10;i++) {a[i]=0;b[i]=0;} for(i=0;i<101;i++) c[i]=0; for(i=0;i<f;i++) scanf("%d",&a[i]); for(j=0;j<r;j++) scanf("%d",&b[j]); double max=0.0,l; k=0; for(i=0;i<f;i++) for(j=0;j<r;j++) { c[k]=(double)b[j]/a[i]; k++; } sort(c,c+k); for(i=0;i<k-1;i++) if(c[i+1]/c[i]>max) max=c[i+1]/c[i]; printf("%.2lf\n",max+0.005); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator