回答編集履歴
1
追記
test
CHANGED
@@ -1,2 +1,21 @@
|
|
1
1
|
隣接する同じ要素を見つけるなら [std::adjacent_find](https://cpprefjp.github.io/reference/algorithm/adjacent_find.html) 使うのが手っ取り早いのでは?
|
2
2
|
|
3
|
+
```C++
|
4
|
+
#include <iostream>
|
5
|
+
#include <vector>
|
6
|
+
#include <algorithm>
|
7
|
+
|
8
|
+
int main() {
|
9
|
+
using namespace std;
|
10
|
+
vector<int> data(5);
|
11
|
+
for (int i = 0; i < 5; i++) {
|
12
|
+
cin >> data.at(i);
|
13
|
+
}
|
14
|
+
if ( adjacent_find(data.begin(), data.end()) != data.end() ) {
|
15
|
+
cout << "YES" << endl;
|
16
|
+
} else {
|
17
|
+
cout << "NO" << endl;
|
18
|
+
}
|
19
|
+
|
20
|
+
}
|
21
|
+
```
|