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

Re 把你的数组开大点,

Posted by 1008061011 at 2011-08-04 22:33:12 on Problem 3300
In Reply To:不知道为什么,就是WA,请大牛们指教一下。 Posted by:hairlun at 2007-12-22 11:11:05
#include<stdio.h>
int main()
{ int i,j,t,f,r,p,a[12],b[12];
  float c[150],max,m;
  while(1)
  { scanf("%d",&f);
    if(f==0) break;
    scanf("%d",&r);
    for(i=0;i<f;i++) scanf("%d",&a[i]);
    for(i=0;i<r;i++) scanf("%d",&b[i]);
    t=-1;
    for(i=0;i<f;i++)
      for(j=0;j<r;j++)
      { t++;
        c[t]=(float)b[j]/a[i];
      }
    for(i=0;i<t;i++)
    { p=0;
      for(j=0;j<t-i;j++)
        if(c[j]<c[j+1])
        { p++;
          m=c[j];
          c[j]=c[j+1];
          c[j+1]=m;
        }
      if(p=0) break;
    }
    max=0;
    for(i=0;i<t;i++)
      if(max<c[i]/c[i+1]) max=c[i]/c[i+1];
    printf("%.2f\n",max);
  }
}


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