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 |
菜鸟求救,为何WAQ_Q#include<stdio.h> int main() { int n,k,i,j; long long int a[1001],b[1001],t=0,p[1001],q[1001],sum1=0,sum2=0,h=0; double answer; while(~scanf("%d %d",&n,&k) && n!=0 && k!=0) { answer=0;sum1=0;sum2=0;t=0; for(i=0;i<n;i++) { scanf("%lld",&a[i]); sum1+=a[i]; } for(i=0;i<n;i++) { scanf("%lld",&b[i]); sum2+=b[i]; } for(j=0;j<k;j++) { for(i=0;i<n;i++) { if(p[i]!=a[i] && q[i]!=b[i]) if(t>a[i]-b[i]) { t=a[i]-b[i]; p[i]=a[i]; q[i]=b[i]; h=i; } } sum1-=p[h]; sum2-=q[h]; } answer=(double)sum1/(double)sum2; printf("%.f\n",100*answer); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator