結果

問題 No.135 とりあえず1次元の問題
ユーザー ottyajp
提出日時 2015-05-09 01:01:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 442 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 58,104 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-03 05:53:26
合計ジャッジ時間 20,062 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 4 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stdlib.h>
using namespace std;

int main(){
	int n;
	cin>>n;
	int x[n];
	int absv = 1000000;
	int abst;
int j;
cin>>x[0];
	for (int i = 1; i < n ; ++i)
	{
		cin>>x[i];
		for (j = 0; j < i; ++j)
		{
			abst=abs(x[i]-x[j]);
			if(abst == 0){
				cout<<"0"<<endl;
				return 0;
			}
			if(absv == 1){
				cout<<"1"<<endl;
				return 0;
			}
			if( abst <= absv ){
				absv = abst;
			}
		}
	}
		cout<<absv<<endl;

}
0