結果
問題 |
No.467 隠されていたゲーム
|
ユーザー |
|
提出日時 | 2016-12-18 11:38:17 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 117 ms / 2,000 ms |
コード長 | 980 bytes |
コンパイル時間 | 2,834 ms |
コンパイル使用メモリ | 78,440 KB |
実行使用メモリ | 55,140 KB |
最終ジャッジ日時 | 2024-10-04 16:18:23 |
合計ジャッジ時間 | 6,608 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder467_1 { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); int[] d = new int[n]; for (int i = 0; i < n; i++) { d[i] = sc.nextInt(); } Arrays.sort(d); int maxd = d[n - 1]; int x = Math.abs(sc.nextInt()); int y = Math.abs(sc.nextInt()); int maxx = Math.max(x, y); if (maxx == 0) { pr.println(0); return; } for (int e : d) { if (e == maxx) { pr.println(1); return; } } if (maxx % maxd == 0) { pr.println(maxx / maxd); } else { pr.println(Math.max(0, maxx / maxd - 1) + 2); } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }