結果

問題 No.2227 King Kraken's Attack
ユーザー tentententen
提出日時 2023-07-26 16:33:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 2,127 bytes
コンパイル時間 3,022 ms
コンパイル使用メモリ 90,124 KB
実行使用メモリ 51,632 KB
最終ジャッジ日時 2024-04-14 06:15:13
合計ジャッジ時間 7,304 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
50,500 KB
testcase_01 AC 54 ms
50,408 KB
testcase_02 AC 53 ms
50,056 KB
testcase_03 AC 57 ms
50,568 KB
testcase_04 AC 54 ms
50,404 KB
testcase_05 AC 54 ms
50,588 KB
testcase_06 AC 57 ms
50,296 KB
testcase_07 AC 54 ms
50,412 KB
testcase_08 AC 59 ms
50,168 KB
testcase_09 AC 55 ms
50,416 KB
testcase_10 AC 54 ms
50,496 KB
testcase_11 AC 55 ms
50,448 KB
testcase_12 AC 54 ms
50,008 KB
testcase_13 AC 54 ms
50,496 KB
testcase_14 AC 166 ms
51,252 KB
testcase_15 AC 73 ms
51,276 KB
testcase_16 AC 129 ms
51,080 KB
testcase_17 AC 105 ms
51,484 KB
testcase_18 AC 53 ms
50,060 KB
testcase_19 AC 72 ms
51,404 KB
testcase_20 AC 72 ms
51,284 KB
testcase_21 AC 92 ms
51,632 KB
testcase_22 AC 69 ms
51,084 KB
testcase_23 AC 68 ms
51,012 KB
testcase_24 AC 94 ms
51,112 KB
testcase_25 AC 53 ms
50,164 KB
testcase_26 AC 224 ms
51,548 KB
testcase_27 AC 53 ms
50,164 KB
testcase_28 AC 82 ms
51,364 KB
testcase_29 AC 71 ms
51,180 KB
testcase_30 AC 91 ms
51,124 KB
testcase_31 AC 80 ms
51,564 KB
testcase_32 AC 69 ms
51,268 KB
testcase_33 AC 71 ms
51,284 KB
testcase_34 AC 75 ms
50,776 KB
testcase_35 AC 74 ms
51,200 KB
testcase_36 AC 67 ms
51,224 KB
testcase_37 AC 54 ms
50,276 KB
testcase_38 AC 54 ms
50,348 KB
testcase_39 AC 53 ms
50,424 KB
testcase_40 AC 53 ms
50,544 KB
testcase_41 AC 54 ms
50,272 KB
testcase_42 AC 53 ms
50,496 KB
testcase_43 AC 53 ms
50,028 KB
testcase_44 AC 54 ms
50,388 KB
testcase_45 AC 53 ms
50,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int h = sc.nextInt();
        int w = sc.nextInt();
        int la = sc.nextInt();
        int lb = sc.nextInt();
        long ka = sc.nextLong();
        long kb = sc.nextLong();
        int left = 0;
        int right = 2000000;
        while (right - left > 1) {
            int m = (left + right) / 2;
            boolean enable = false;
            for (long a = 0; a <= m && !enable; a++) {
                long b = m - a;
                enable = ((long)h * w - Math.min(h, a * la) * Math.min(w, b * lb) <= ka * a + kb * b);
            }
            if (enable) {
                right = m;
            } else {
                left = m;
            }
        }
        System.out.println(right);
    }
}
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0