結果
| 問題 |
No.116 門松列(1)
|
| ユーザー |
toshiro_yanagi
|
| 提出日時 | 2019-01-07 06:52:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 366 bytes |
| コンパイル時間 | 676 ms |
| コンパイル使用メモリ | 63,232 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 01:47:13 |
| 合計ジャッジ時間 | 1,247 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <iostream>
using namespace std;
int main()
{
const int MAX = 100;
int n, A[MAX];
cin >> n;
int ans = 0;
for (int i = 0; i < n; i++)
{
cin >> A[i];
if (i >= 2)
{
int a = A[i - 2], b = A[i - 1], c = A[i];
if (b > a && b > c && a != c)
{
ans++;
}
if (b < a && b < c && a != c)
{
ans++;
}
}
}
cout << ans << endl;
}
toshiro_yanagi