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

Help//

Posted by qyzg at 2005-10-04 01:04:19 on Problem 1064
#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:
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