結果

問題 No.135 とりあえず1次元の問題
コンテスト
ユーザー regulus
提出日時 2017-11-22 18:52:36
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 326 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 224 ms
コンパイル使用メモリ 39,108 KB
最終ジャッジ日時 2026-02-22 00:33:27
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

#define F(i,n) for(int i = 0;i < n;i++)
#define N 1000001

int main(void){
	int n,t,r=N;
	scanf("%d",&n);
	int a[n];
	F(i,n)scanf("%d",&a[i]);
	//z(a,a,n);
	F(i,n){
		if(i==n-1)break;
		t=a[i]-a[i+1];
		if(t!=0){
			if(t<0)t*=-1;
			if(r>t){
				r=t;
			}
		}
	}
	if(r==N)r=0;
	printf("%d",r);
	return 0;
}
0