結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
カニ戯(ry
|
| 提出日時 | 2015-05-15 02:41:31 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 593 ms / 5,000 ms |
| コード長 | 427 bytes |
| コンパイル時間 | 2,880 ms |
| コンパイル使用メモリ | 77,856 KB |
| 実行使用メモリ | 50,184 KB |
| 最終ジャッジ日時 | 2025-01-03 05:54:27 |
| 合計ジャッジ時間 | 10,808 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] a) {
Scanner s = new Scanner(System.in);
int N=s.nextInt(),i=0,d,m=Integer.MAX_VALUE;
int[] X=new int[N];
for(;i<N;)X[i++]=s.nextInt();
Arrays.sort(X);
for(i=0;i<N-1;)m=((d=Math.abs(X[i]-X[++i]))>0&&d<m)?d:m;
System.out.println(m==Integer.MAX_VALUE?0:m);
}
}
カニ戯(ry