hiho week 148 register

Ended

Participants:382

Verdict:Accepted
Score:100 / 100
Submitted:2017-05-06 12:13:02

Lang:Java

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
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main {
    static int npwh;
    static int[] a;
    public static void main(String[] args) {
        int task;
        Scanner sc = new Scanner(System.in);
        task = sc.nextInt();
        while (task-- > 0) {
            n = sc.nextInt();
            p = sc.nextInt();
            w = sc.nextInt();
            h = sc.nextInt();
            a = new int[n];
            for (int i = 0i < ni++)
                a[i= sc.nextInt();
            int l = 1;
            int r = Math.min(w,h);
            while (l < r - 1) {
                int mid = (l + r) / 2;
                if (noMoreThanP(mid))
                    l = mid;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX