結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
ちよちゃん
|
| 提出日時 | 2016-06-06 19:53:48 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 655 bytes |
| 記録 | |
| コンパイル時間 | 3,525 ms |
| コンパイル使用メモリ | 83,916 KB |
| 実行使用メモリ | 107,732 KB |
| 最終ジャッジ日時 | 2026-03-03 21:59:07 |
| 合計ジャッジ時間 | 37,073 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 TLE * 4 |
ソースコード
package yukicoder;
import java.util.Scanner;
public class Yuki135 {
public static void main(String[] args ) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int x[] = new int[n];
for(int i = 0; i < n; i++) {
x[i] = scan.nextInt();
}
scan.close();
int ans = 0;
int perseAns = 0;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if( x[i] > x[j] ){
ans = x[i]-x[j];
} else {
ans = x[j]-x[i];
}
if(perseAns == 0) {
perseAns = ans;
}else if ( ans < perseAns && ans != 0) {
perseAns = ans;
}
}
}
System.out.println(perseAns);
}
}
ちよちゃん