結果

問題 No.116 門松列(1)
ユーザー okkuukenken
提出日時 2018-10-03 18:49:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 299 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 53,984 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 01:44:19
合計ジャッジ時間 1,214 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main() {
	int n, a, b, c;
	cin >> n >> b >> c;
	int ans = 0;
	for (int i = 0; i < n - 2; ++i) {
		a = b;
		b = c;
		cin >> c;
		if (a != b && b != c && c != a && !(a > b && b > c || a < b && b < c))
			ans++;
	}
	cout << ans << endl;
}
0