結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
かぼちゃ
|
| 提出日時 | 2018-03-26 23:32:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 436 bytes |
| コンパイル時間 | 524 ms |
| コンパイル使用メモリ | 64,820 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-07 12:22:37 |
| 合計ジャッジ時間 | 2,291 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int dx,n;
cin >> n;
vector<int> x(n);
for(int i = 0;i < n;i++){
cin >> x[i];
}
sort(x.begin(),x.end());
dx = x[1] - x[0];
string ans = "YES\n";
if(dx == 0)ans = "NO\n";
for(int i = 2;i < n;i++){
if(x[i]-x[i-1] != dx)ans = "NO\n";
}
cout << ans;
return 0;
}
かぼちゃ