結果

問題 No.406 鴨等間隔の法則
コンテスト
ユーザー Maeda
提出日時 2025-03-18 10:38:32
言語 C
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
TLE  
実行時間 -
コード長 646 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 145 ms
コンパイル使用メモリ 39,360 KB
最終ジャッジ日時 2026-02-22 13:17:37
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other TLE * 2 -- * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <stdbool.h>

void main(void) {
	int n = 0;
	scanf("%d",&n);
	int duckList[n];
	for(int i = 0 ; i < n ; i++){
		scanf("%d",&duckList[i]);
	}
	bool duckFlg = true;
	for(int i = 0 ; i < n ; i++){
		for(int j = i ; j < n ; j++){
		 	if(duckList[i] < duckList[j]){
				int num = duckList[i];
				duckList[i] = duckList[j];
				duckList[j] = num;
		 	}
		}
	}
	int criteria = duckList[0] - duckList[1];
	if(criteria == 0){
		duckFlg = false;
	}else{
		for(int i = 1 ; i < n-1 ; i++){
			if(criteria != duckList[i] - duckList[i+1]){
				duckFlg = false;
			}
		}
	}
	if(duckFlg){
		printf("YES");
	}else{
		printf("NO");
	}
}
0