結果
問題 | No.116 門松列(1) |
ユーザー |
![]() |
提出日時 | 2019-04-12 17:26:54 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 386 bytes |
コンパイル時間 | 178 ms |
コンパイル使用メモリ | 29,184 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 01:52:19 |
合計ジャッジ時間 | 1,030 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
// yukicoder: No.116 門松列(1) // 2019.4.12 bal4u #include <stdio.h> int a[102], N; int main() { int i, ans; scanf("%d", &N); for (i = 0; i < N; i++) scanf("%d", a + i); ans = 0; for (i = 1; i < N - 1; i++) { if ((a[i-1] < a[i] && a[i] > a[i+1] && a[i-1] != a[i+1]) || (a[i-1] > a[i] && a[i] < a[i+1] && a[i-1] != a[i+1])) ans++; } printf("%d\n", ans); return 0; }