結果

問題 No.2227 King Kraken's Attack
ユーザー tentententen
提出日時 2023-03-30 16:11:11
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 2,217 bytes
コンパイル時間 2,502 ms
コンパイル使用メモリ 84,964 KB
実行使用メモリ 51,604 KB
最終ジャッジ日時 2024-04-10 09:53:02
合計ジャッジ時間 7,248 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
50,448 KB
testcase_01 AC 52 ms
50,268 KB
testcase_02 AC 53 ms
50,476 KB
testcase_03 AC 57 ms
50,220 KB
testcase_04 AC 54 ms
50,512 KB
testcase_05 AC 54 ms
50,104 KB
testcase_06 AC 58 ms
50,496 KB
testcase_07 AC 53 ms
50,172 KB
testcase_08 AC 57 ms
50,520 KB
testcase_09 AC 53 ms
50,376 KB
testcase_10 AC 53 ms
50,072 KB
testcase_11 AC 54 ms
50,276 KB
testcase_12 AC 54 ms
50,484 KB
testcase_13 AC 53 ms
50,428 KB
testcase_14 AC 195 ms
51,220 KB
testcase_15 AC 103 ms
51,280 KB
testcase_16 AC 174 ms
51,264 KB
testcase_17 AC 115 ms
51,344 KB
testcase_18 RE -
testcase_19 AC 74 ms
51,416 KB
testcase_20 AC 76 ms
51,468 KB
testcase_21 AC 100 ms
51,304 KB
testcase_22 AC 86 ms
51,448 KB
testcase_23 AC 72 ms
51,336 KB
testcase_24 AC 118 ms
51,432 KB
testcase_25 RE -
testcase_26 AC 200 ms
51,604 KB
testcase_27 RE -
testcase_28 AC 80 ms
51,100 KB
testcase_29 AC 71 ms
51,312 KB
testcase_30 AC 99 ms
51,284 KB
testcase_31 AC 82 ms
51,540 KB
testcase_32 AC 74 ms
51,304 KB
testcase_33 AC 72 ms
51,112 KB
testcase_34 AC 68 ms
51,136 KB
testcase_35 AC 73 ms
51,580 KB
testcase_36 AC 72 ms
51,256 KB
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 AC 53 ms
50,520 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();
        long h = sc.nextInt();
        long w = sc.nextInt();
        long la = sc.nextInt();
        long lb = sc.nextInt();
        long ka = sc.nextInt();
        long kb = sc.nextInt();
        int left = 0;
        int right = Integer.MAX_VALUE / 2;
        while (right - left > 1) {
            int m = (left + right) / 2;
            boolean enable = false;
            for (int a = 0; a <= m && !enable; a++) {
                int b = m - a;
                long aa = Math.max(0, h - a * la);
                long bb = Math.max(0, w - b * lb);
                enable = (aa * w + bb * h - aa * bb - ka * a - kb * b <= 0);
            }
            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