結果
問題 |
No.116 門松列(1)
|
ユーザー |
![]() |
提出日時 | 2019-07-31 17:52:02 |
言語 | PHP (843.2) |
結果 |
AC
|
実行時間 | 41 ms / 5,000 ms |
コード長 | 646 bytes |
コンパイル時間 | 125 ms |
コンパイル使用メモリ | 32,144 KB |
実行使用メモリ | 31,488 KB |
最終ジャッジ日時 | 2024-07-05 06:53:07 |
合計ジャッジ時間 | 1,795 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $number = trim(fgets(STDIN)); $bamboo = explode(" ", trim(fgets(STDIN))); $ans = 0; for ($i=0; $i<$number-2; $i++){ if ($bamboo[$i] < $bamboo[$i+1] && $bamboo[$i+1] > $bamboo[$i+2] && $bamboo[$i] != $bamboo[$i+2] || ($bamboo[$i] > $bamboo[$i+1] && $bamboo[$i+1] < $bamboo[$i+2] && $bamboo[$i] != $bamboo[$i+2]) || ($bamboo[$i] > $bamboo[$i+1] && $bamboo[$i+1] < $bamboo[$i+2] && $bamboo[$i] != $bamboo[$i+2]) || ($bamboo[$i] < $bamboo[$i+1] && $bamboo[$i+1] > $bamboo[$i+2] && $bamboo[$i] != $bamboo[$i+2])){ $ans ++; } } echo $ans;