結果

問題 No.116 門松列(1)
ユーザー Kura
提出日時 2019-02-22 13:08:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 308 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 58,364 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-24 06:46:44
合計ジャッジ時間 1,263 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 4 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int c=0;
    for(int i=0;i<n-2;i++){
        if((a[i]<a[i+1]&&a[i+1]>a[i+2]&&a[i]!=a[i+1])||(a[i]>a[i+1]&&a[i+1]<a[i+2]&&a[i]!=a[i+2])){
            c++;
        }
    }
    cout<<c<<endl;
}
0