hiho week 148 register

Ended

Participants:382

Verdict:Accepted
Score:100 / 100
Submitted:2017-05-01 10:44:31

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+20;
int n,p,w,h,a[N];
bool check(int x)
{
    int cnt=0;
    int col=w/x,row=h/x;
    if(col==0||row==0)
        return false;
    for(int i=1;i<=n;i++)
    {
        cnt+=a[i]/col;//Ò»¶ÎÕ¼¶àÉÙÐР
        if(a[i]%col)
            cnt++;
    } 
    cnt=cnt/row;//Õ¼Á˶àÉÙÒ³ 
    if(cnt%row)
        cnt++;
    return cnt<=p;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cin>>n>>p>>w>>h;
        for(int i=1;i<=n;i++)
            scanf("%d",&a[i]);
        int l=1,r=2e8;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX