結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2018-10-03 00:48:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 49 ms / 2,000 ms |
コード長 | 772 bytes |
コンパイル時間 | 977 ms |
コンパイル使用メモリ | 99,676 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 12:30:31 |
合計ジャッジ時間 | 2,970 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <stdio.h> #include <algorithm> #include <iostream> #include <string> #include <vector> #include <functional> #include <map> #include <iomanip> #include <math.h> #include <stack> #include <queue> #include <bitset> #include <cstdlib> #include <tuple> #include <cctype> #include <ctype.h> #include <set> #include <sstream> using namespace std; int main() { int i, j, k; int n; vector<long>x; cin >> n; for (i = 0; i < n; i++) { long num; cin >> num; x.push_back(num); } sort(x.begin(), x.end()); long sa = x[1] - x[0]; if (sa == 0) { cout << "NO" << endl; return 0; } for (i = 1; i < n; i++) { if (x[i] - x[i - 1] != sa) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; getchar(); getchar(); return 0; }