結果
問題 | No.116 門松列(1) |
ユーザー |
|
提出日時 | 2017-10-25 00:27:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 641 ms |
コンパイル使用メモリ | 68,864 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 01:34:38 |
合計ジャッジ時間 | 1,386 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <iostream> #include <vector> using namespace std; int main() { int N; cin>> N; vector<int> a(N); for(int i = 0; i < N;i++){ cin >> a[i]; } int num = 0; for(int i= 0; i < N-2; i++){ if(a[i] < a[i+1] and a[i+1] > a[i+2] and a[i]!=a[i+2]){ num++; } else if(a[i] > a[i+1] and a[i+1] < a[i+2] and a[i]!=a[i+2]){ num++; } } cout <<num<<endl; return 0; }