結果
問題 | No.116 門松列(1) |
ユーザー |
|
提出日時 | 2018-05-03 00:30:48 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 353 bytes |
コンパイル時間 | 1,076 ms |
コンパイル使用メモリ | 28,928 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 01:40:26 |
合計ジャッジ時間 | 980 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <stdio.h>#include <stdlib.h>int main(void){int n, *a, i, s = 0;scanf("%d", &n);a = malloc(sizeof(int)*n);for (i = 0; i < n; i++) scanf("%d", &a[i]);for (i = 0; i < n - 2; i++) (a[i]<a[i + 1] && a[i + 1]>a[i + 2] || a[i] > a[i + 1] && a[i + 1] < a[i + 2]) && a[i] != a[i + 2] ? s++ : 0;printf("%d\n", s);return 0;}