結果
問題 |
No.716 距離
|
ユーザー |
|
提出日時 | 2018-09-16 17:42:33 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 192 ms / 2,000 ms |
コード長 | 860 bytes |
コンパイル時間 | 3,377 ms |
コンパイル使用メモリ | 75,236 KB |
実行使用メモリ | 42,808 KB |
最終ジャッジ日時 | 2024-07-18 07:25:35 |
合計ジャッジ時間 | 11,487 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder716 { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int min = Integer.MAX_VALUE; for (int i = 1; i < n; i++) { min = Math.min(min, a[i] - a[i - 1]); } pr.println(min); pr.println(a[n - 1] - a[0]); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes())); pr = new Printer(System.out); solve(); // pr.close(); pr.flush(); // sc.close(); } static String INPUT = null; private static class Printer extends PrintWriter { Printer(OutputStream out) { super(out); } } }