| ||||||||||
| 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 | |||||||||
Help//#include<iostream.h>
#include<stdio.h>
main()
{
int max=0,min,mid;
int l=0,i;
int p[10000];
float temp;
int m,n;
cin>>m>>n;
for(i=0;i<m;i++)
{
cin>>temp;
temp=100.0*temp;
max=max+temp/n+1;
p[i]=temp;
}
min=0;
while(min!=max)
{
mid=(max+min+1)/2;
l=0;
for(i=0;i<m;i++)
l=l+p[i]/mid;
if(l>=n)
min=mid;
else
max=mid-1;
}
printf("%.2f\n",min/100.0);
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator