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 |
为毛WA呢,感觉这个二叉是对的啊#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; #define N 10010 #define MAX 10000000 int a[N]; int main() { int n,m; double len; while(scanf("%d%d",&n,&m)!=EOF) { int Max = 0; for(int i=0; i<n; i++) { scanf("%lf",&len); a[i] = len * 100; Max = max(Max , a[i]); } int low = 1 , high = Max; while(low < high) { int mid = low + (high - low + 1) / 2; int count = 0; for(int i=0; i<n; i++) count += a[i] / mid; if(count >= m) low = mid; else high = mid - 1; } printf("%.2f\n",(double)(low)/ 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