結果
問題 | No.2227 King Kraken's Attack |
ユーザー | tenten |
提出日時 | 2023-07-26 16:33:48 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 220 ms / 2,000 ms |
コード長 | 2,127 bytes |
コンパイル時間 | 2,735 ms |
コンパイル使用メモリ | 88,920 KB |
実行使用メモリ | 38,252 KB |
最終ジャッジ日時 | 2024-10-03 03:31:21 |
合計ジャッジ時間 | 7,536 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
36,928 KB |
testcase_01 | AC | 53 ms
37,072 KB |
testcase_02 | AC | 53 ms
37,084 KB |
testcase_03 | AC | 57 ms
37,224 KB |
testcase_04 | AC | 52 ms
37,100 KB |
testcase_05 | AC | 53 ms
36,860 KB |
testcase_06 | AC | 54 ms
37,112 KB |
testcase_07 | AC | 52 ms
37,100 KB |
testcase_08 | AC | 55 ms
37,056 KB |
testcase_09 | AC | 54 ms
37,092 KB |
testcase_10 | AC | 53 ms
36,572 KB |
testcase_11 | AC | 54 ms
37,116 KB |
testcase_12 | AC | 51 ms
36,936 KB |
testcase_13 | AC | 53 ms
36,836 KB |
testcase_14 | AC | 220 ms
37,884 KB |
testcase_15 | AC | 75 ms
37,968 KB |
testcase_16 | AC | 120 ms
38,096 KB |
testcase_17 | AC | 101 ms
38,028 KB |
testcase_18 | AC | 55 ms
37,096 KB |
testcase_19 | AC | 71 ms
38,140 KB |
testcase_20 | AC | 70 ms
37,868 KB |
testcase_21 | AC | 87 ms
37,840 KB |
testcase_22 | AC | 68 ms
37,836 KB |
testcase_23 | AC | 79 ms
37,480 KB |
testcase_24 | AC | 92 ms
38,252 KB |
testcase_25 | AC | 54 ms
37,016 KB |
testcase_26 | AC | 176 ms
37,972 KB |
testcase_27 | AC | 54 ms
37,112 KB |
testcase_28 | AC | 78 ms
37,712 KB |
testcase_29 | AC | 74 ms
38,124 KB |
testcase_30 | AC | 95 ms
38,112 KB |
testcase_31 | AC | 81 ms
37,864 KB |
testcase_32 | AC | 75 ms
38,052 KB |
testcase_33 | AC | 72 ms
38,112 KB |
testcase_34 | AC | 66 ms
37,620 KB |
testcase_35 | AC | 82 ms
38,088 KB |
testcase_36 | AC | 73 ms
37,492 KB |
testcase_37 | AC | 54 ms
36,944 KB |
testcase_38 | AC | 53 ms
37,076 KB |
testcase_39 | AC | 54 ms
37,088 KB |
testcase_40 | AC | 54 ms
37,072 KB |
testcase_41 | AC | 52 ms
36,868 KB |
testcase_42 | AC | 52 ms
36,936 KB |
testcase_43 | AC | 53 ms
36,972 KB |
testcase_44 | AC | 55 ms
36,972 KB |
testcase_45 | AC | 54 ms
36,640 KB |
ソースコード
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(); } }