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

为毛WA呢,感觉这个二叉是对的啊

Posted by Atanisi at 2017-12-16 22:21:19 on Problem 1064
#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:
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