結果

問題 No.24 数当てゲーム
ユーザー ayaaya
提出日時 2019-07-24 15:43:41
言語 PHP
(8.2.11)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 917 bytes
コンパイル時間 57 ms
コンパイル使用メモリ 18,660 KB
実行使用メモリ 18,888 KB
最終ジャッジ日時 2023-09-10 10:18:55
合計ジャッジ時間 897 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
18,888 KB
testcase_01 AC 15 ms
18,792 KB
testcase_02 AC 16 ms
18,680 KB
testcase_03 AC 15 ms
18,748 KB
testcase_04 AC 15 ms
18,760 KB
testcase_05 AC 15 ms
18,848 KB
testcase_06 AC 15 ms
18,848 KB
testcase_07 AC 15 ms
18,712 KB
testcase_08 AC 15 ms
18,860 KB
testcase_09 AC 16 ms
18,888 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php


$array=array_fill(0,10,null);
$N=trim(fgets(STDIN));
for($i=0;$i<$N;$i++){
  $line=trim(fgets(STDIN));
  $input= explode(" ",$line);
  if($input[4]=="NO"){
    for($x=0;$x<4;$x++){
      $array[$input[$x]]=0;
    }
  }elseif($input[4]=="YES"){
    for($y=0;$y<4;$y++){
      $hantei=$array[$input[$y]];
      if(is_null($array[$input[$y]])){
        $array[$input[$y]]=1;
      }elseif($array[$input[$y]]===1){
        $array[$input[$y]]=2;
      }elseif($array[$input[$y]]===2){
      $array[$input[$y]]=3;
      }elseif($array[$input[$y]]===3){
        $array[$input[$y]]=4;
        }
      
    }
  }
}
arsort($array);
foreach ($array as $key =>$value){

  if($value==4){
    echo $key;
    break;
  }elseif($value==3){
    echo $key;
    break;
  }elseif($value==2){
    echo $key;
    break;
  }else if($value==1){
    echo $key;
    break;
  }else if(is_null($value)){
    echo $key;
    break;
}

}

?>
0