結果
問題 | No.116 門松列(1) |
ユーザー |
![]() |
提出日時 | 2018-01-23 22:36:45 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 424 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 63,260 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 01:36:07 |
合計ジャッジ時間 | 1,318 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include<iostream>#include<vector>#include<algorithm>#include<cstdio>using namespace std;int main(){vector<int> vc;int N,x,count=0;cin >> N;while(N--){cin >> x;vc.push_back(x);}for(int i=1;i<vc.size()-1;i++){if((vc[i-1]<vc[i]&&vc[i+1]<vc[i]&&vc[i-1]!=vc[i+1])||(vc[i-1]>vc[i]&&vc[i+1]>vc[i]&&vc[i-1]!=vc[i+1])) count++;}cout << count;return 0;}