hiho week 148 register

Ended

Participants:382

Verdict:Accepted
Score:100 / 100
Submitted:2017-05-01 21:27:26

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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ff(i, n) for (int i = 0, END = (n); i < n; i ++)
#define fff(i, n, m) for (int i = (n), END = (m); i <= m; i ++)
int dp[1111];
int n, p, w, h;
int page(int s) {
    if (w < s || h < s) return 1e7;
    int col = w / s;
    int row = h / s;
    int row_need = 0;
    ff (i, n) {
        row_need += (dp[i] - 1) / col + 1;
    }
    return (row_need - 1) / row + 1;
}
int main() {
    int T; cin >> T;
    ff (t, T) {
        cin >> n >> p >> w >> h;
        ff (i, n) cin >> dp[i];
        int l = 1, r = 1e6;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX