結果
問題 | No.467 隠されていたゲーム |
ユーザー | 37zigen |
提出日時 | 2016-12-18 01:28:10 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 145 ms / 2,000 ms |
コード長 | 783 bytes |
コンパイル時間 | 4,427 ms |
コンパイル使用メモリ | 77,772 KB |
実行使用メモリ | 54,472 KB |
最終ジャッジ日時 | 2024-04-15 04:42:44 |
合計ジャッジ時間 | 8,824 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 140 ms
54,132 KB |
testcase_01 | AC | 140 ms
54,436 KB |
testcase_02 | AC | 138 ms
54,348 KB |
testcase_03 | AC | 142 ms
54,088 KB |
testcase_04 | AC | 139 ms
54,148 KB |
testcase_05 | AC | 138 ms
53,972 KB |
testcase_06 | AC | 138 ms
54,200 KB |
testcase_07 | AC | 142 ms
54,284 KB |
testcase_08 | AC | 145 ms
53,968 KB |
testcase_09 | AC | 145 ms
54,060 KB |
testcase_10 | AC | 139 ms
54,084 KB |
testcase_11 | AC | 138 ms
54,096 KB |
testcase_12 | AC | 138 ms
54,012 KB |
testcase_13 | AC | 138 ms
54,400 KB |
testcase_14 | AC | 136 ms
54,364 KB |
testcase_15 | AC | 137 ms
54,140 KB |
testcase_16 | AC | 138 ms
54,156 KB |
testcase_17 | AC | 143 ms
54,232 KB |
testcase_18 | AC | 143 ms
54,204 KB |
testcase_19 | AC | 143 ms
54,472 KB |
testcase_20 | AC | 141 ms
54,464 KB |
testcase_21 | AC | 142 ms
54,316 KB |
testcase_22 | AC | 141 ms
54,392 KB |
testcase_23 | AC | 137 ms
54,072 KB |
testcase_24 | AC | 138 ms
54,100 KB |
testcase_25 | AC | 138 ms
54,260 KB |
testcase_26 | AC | 137 ms
53,888 KB |
ソースコード
package yukicoder; import java.util.*; public class Q467 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] d = new long[n]; for (int i = 0; i < n; ++i) { d[i] = sc.nextLong(); } long x = sc.nextLong(); long y = sc.nextLong(); x = Math.abs(x); y = Math.abs(y); Arrays.sort(d); long ans = 0; if (x == 0 && y == 0) { System.out.println(0); return; } if (Math.max(x, y) > 2 * d[n - 1]) { long c = Math.max(x / d[n - 1], y / d[n - 1]); x = Math.max(0, x - d[n - 1] * (c - 1)); y = Math.max(0, y - d[n - 1] * (c - 1)); ans += c - 1; } ans += 2; for (int i = 0; i < n; ++i) { if (Math.max(x, y) == d[i]) { --ans; break; } } System.out.println(ans); } }