hiho week 148 register

Ended

Participants:382

Verdict:Accepted
Score:100 / 100
Submitted:2017-05-02 16:14:13

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.util.Scanner;
public class Main {
        public static void main(String[] args) {
        int TNPWH;
        Scanner scanner = new Scanner(System.in);
        T = scanner.nextInt();
        while (T > 0) {
            N = scanner.nextInt();
            P = scanner.nextInt();
            W = scanner.nextInt();
            H = scanner.nextInt();
            int[] charsCount = new int[N];
            for (int i = 0i <= N - 1i++) {
                charsCount[i= scanner.nextInt();
            }
            System.out.println(maxFontSize(NPWHcharsCount));
            T--;
        }
    }
    public static int maxFontSize(int Nint Pint Wint Hint[] charsCount) {
        int start = 1end = Math.min(WH);
        int res = 0;
        while (start <= end) {
            int mid = start + (end - start) / 2;
            int maxLine = P * (H / mid);
            int count = 0;
            int lineCount = W / mid// 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX