結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー | chiho_miyako |
提出日時 | 2015-04-06 22:22:53 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 692 bytes |
コンパイル時間 | 1,895 ms |
コンパイル使用メモリ | 72,596 KB |
実行使用メモリ | 61,024 KB |
最終ジャッジ日時 | 2023-09-01 03:16:33 |
合計ジャッジ時間 | 8,588 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 561 ms
60,704 KB |
testcase_01 | AC | 119 ms
56,248 KB |
testcase_02 | WA | - |
testcase_03 | AC | 118 ms
54,564 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 148 ms
56,496 KB |
testcase_13 | AC | 131 ms
56,040 KB |
testcase_14 | AC | 168 ms
55,736 KB |
testcase_15 | AC | 150 ms
56,140 KB |
testcase_16 | WA | - |
testcase_17 | AC | 172 ms
56,436 KB |
testcase_18 | AC | 132 ms
55,800 KB |
testcase_19 | AC | 174 ms
56,096 KB |
testcase_20 | AC | 173 ms
56,312 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
evil01.txt | AC | 564 ms
65,372 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); int n = koko.nextInt(); int[] x = new int[n]; int[] d = new int[n]; for(int i = 0; i<n; i++){ x[i] = koko.nextInt(); } Arrays.sort(x); int dis; if(n>2){ dis = x[1]-x[0]; for(int i = 1; i<n; i++){ d[i]=x[i]-x[i-1]; if(d[i]<dis){ dis = d[i]; } } }else if(n==2){ dis = x[1]-x[0]; }else{ dis = 0; } System.out.println(dis); } }