結果

問題 No.406 鴨等間隔の法則
ユーザー square1001
提出日時 2016-08-16 19:38:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 170,648 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-07 11:38:12
合計ジャッジ時間 3,378 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int n, a[100009];
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	int s = a[1] - a[0], f = 1;
	for(int i = 2; i < n; i++) {
		if(a[i] - a[i - 1] != s) f = 0;
	}
	if(f && s) cout << "YES" << endl;
	else cout << "NO" << endl;
}
0