結果
| 問題 | 
                            No.135 とりあえず1次元の問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ちよちゃん
                         | 
                    
| 提出日時 | 2016-06-06 19:53:48 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 655 bytes | 
| コンパイル時間 | 2,957 ms | 
| コンパイル使用メモリ | 76,032 KB | 
| 実行使用メモリ | 62,928 KB | 
| 最終ジャッジ日時 | 2024-06-11 06:49:53 | 
| 合計ジャッジ時間 | 15,345 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | -- * 2 | 
| other | TLE * 1 -- * 21 | 
ソースコード
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);
		
	}
}
            
            
            
        
            
ちよちゃん