結果

問題 No.116 門松列(1)
ユーザー Kura
提出日時 2019-02-22 13:09:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 308 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 58,920 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-24 06:49:01
合計ジャッジ時間 1,110 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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+2])||(a[i]>a[i+1]&&a[i+1]<a[i+2]&&a[i]!=a[i+2])){
            c++;
        }
    }
    cout<<c<<endl;
}
0