結果

問題 No.2227 King Kraken's Attack
ユーザー norikamenorikame
提出日時 2023-01-19 02:18:25
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 897 bytes
コンパイル時間 3,759 ms
コンパイル使用メモリ 77,700 KB
実行使用メモリ 54,736 KB
最終ジャッジ日時 2024-04-10 09:14:42
合計ジャッジ時間 9,656 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
54,736 KB
testcase_01 AC 110 ms
53,748 KB
testcase_02 AC 103 ms
53,020 KB
testcase_03 AC 113 ms
54,232 KB
testcase_04 AC 115 ms
54,180 KB
testcase_05 AC 113 ms
54,044 KB
testcase_06 AC 101 ms
52,756 KB
testcase_07 AC 102 ms
52,912 KB
testcase_08 AC 112 ms
54,452 KB
testcase_09 AC 137 ms
54,212 KB
testcase_10 AC 101 ms
52,944 KB
testcase_11 AC 113 ms
54,152 KB
testcase_12 AC 102 ms
52,752 KB
testcase_13 AC 105 ms
52,900 KB
testcase_14 AC 115 ms
53,200 KB
testcase_15 AC 115 ms
54,160 KB
testcase_16 AC 113 ms
54,304 KB
testcase_17 AC 126 ms
53,148 KB
testcase_18 AC 127 ms
54,028 KB
testcase_19 AC 117 ms
54,276 KB
testcase_20 AC 108 ms
53,076 KB
testcase_21 AC 112 ms
53,392 KB
testcase_22 AC 127 ms
54,304 KB
testcase_23 AC 109 ms
53,580 KB
testcase_24 AC 131 ms
54,116 KB
testcase_25 AC 134 ms
54,176 KB
testcase_26 AC 129 ms
54,032 KB
testcase_27 AC 150 ms
54,412 KB
testcase_28 AC 117 ms
53,836 KB
testcase_29 AC 105 ms
53,004 KB
testcase_30 AC 111 ms
53,520 KB
testcase_31 AC 111 ms
52,756 KB
testcase_32 AC 123 ms
54,188 KB
testcase_33 AC 111 ms
52,944 KB
testcase_34 AC 112 ms
54,284 KB
testcase_35 AC 127 ms
54,416 KB
testcase_36 AC 118 ms
54,132 KB
testcase_37 AC 116 ms
54,220 KB
testcase_38 AC 109 ms
53,060 KB
testcase_39 AC 120 ms
54,216 KB
testcase_40 AC 116 ms
54,036 KB
testcase_41 AC 122 ms
54,296 KB
testcase_42 AC 122 ms
54,064 KB
testcase_43 AC 116 ms
53,924 KB
testcase_44 AC 112 ms
54,008 KB
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 

import java.util.*;

public class Main_sol1 {
    private static final int INF = (int)(1e9);
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt(), w = sc.nextInt(), la = sc.nextInt(), lb = sc.nextInt();
        long ka = sc.nextLong(), kb = sc.nextLong();
        sc.close();
        int amx = (h+la-1) / la, bmx = (w+lb-1) / lb, bcnt = bmx + 1, res = INF;
        for (int acnt=0; acnt<=amx; ++acnt) {
            int alen = Math.min(h, acnt*la);
            long adda = acnt * ka;
            while (bcnt > 0) {
                int blen = Math.min(w, (bcnt-1)*lb);
                long addb = (bcnt-1) * kb;
                if ((long)alen*blen+adda+addb < (long)h*w) break;
                --bcnt;
            }
            if (bcnt <= bmx) res = Math.min(res, acnt+bcnt);
        }
        System.out.println(res);
    }
}
0