結果

問題 No.135 とりあえず1次元の問題
ユーザー suppy193suppy193
提出日時 2015-05-27 15:09:34
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 371 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 25,548 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-01 03:39:25
合計ジャッジ時間 28,893 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 0 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 0 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 3,815 ms
4,380 KB
testcase_22 TLE -
evil01.txt TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:23: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]
    if(X[i] != X[j] && abs(X[i] - X[j]) < dmin)dmin = abs(X[i] - X[j]);
                       ^~~

ソースコード

diff #

#include <stdio.h>
#include <math.h>

int main(void) {
	int N, i, j, X[100001], dmin;
	scanf("%d", &N);
	for(i = 1;i <= N;i++){
		scanf("%d", &X[i]);
	}
	dmin = 1000001;
	for(i = 1;i <= N - 1;i++){
		for(j = i + 1;j <= N;j++){
			if(X[i] != X[j] && abs(X[i] - X[j]) < dmin)dmin = abs(X[i] - X[j]);
		}
	}
	if(dmin > 1000000)dmin = 0;
	printf("%d\n", dmin);

	return 0;
}
0