結果

問題 No.116 門松列(1)
ユーザー ayaaya
提出日時 2019-07-31 15:04:40
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 1,939 ms
コンパイル使用メモリ 18,684 KB
実行使用メモリ 18,988 KB
最終ジャッジ日時 2023-10-16 17:30:54
合計ジャッジ時間 3,615 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 15 ms
18,724 KB
testcase_02 AC 15 ms
18,884 KB
testcase_03 AC 15 ms
18,904 KB
testcase_04 AC 15 ms
18,916 KB
testcase_05 AC 15 ms
18,960 KB
testcase_06 AC 15 ms
18,968 KB
testcase_07 AC 15 ms
18,720 KB
testcase_08 WA -
testcase_09 AC 15 ms
18,876 KB
testcase_10 AC 15 ms
18,816 KB
testcase_11 AC 15 ms
18,972 KB
testcase_12 AC 15 ms
18,848 KB
testcase_13 AC 15 ms
18,920 KB
testcase_14 AC 15 ms
18,956 KB
testcase_15 WA -
testcase_16 AC 15 ms
18,848 KB
testcase_17 AC 15 ms
18,896 KB
testcase_18 AC 15 ms
18,828 KB
testcase_19 AC 15 ms
18,932 KB
testcase_20 AC 15 ms
18,716 KB
testcase_21 AC 15 ms
18,852 KB
testcase_22 AC 15 ms
18,968 KB
testcase_23 AC 15 ms
18,928 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$num=trim(fgets(STDIN));
$input=explode(" ",(fgets(STDIN)));
$ans=0;
for($i=0;$i<=$num-3;$i++){
  if($input[$i]==$input[$i+1]||$input[$i]==$input[$i+2]||$input[$i+1]==$input[$i+2]){
    continue;
  }
  $min=min($input[$i],$input[$i+1],$input[$i+2]);
  $max=max($input[$i],$input[$i+1],$input[$i+2]);
  if($input[$i+1]==$min||$input[$i+1]==$max){
    $ans++;
  }
}
echo $ans;
0