結果

問題 No.24 数当てゲーム
ユーザー jshimazu0820jshimazu0820
提出日時 2014-11-23 15:51:50
言語 PHP
(8.3.4)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 663 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 18,676 KB
実行使用メモリ 18,872 KB
最終ジャッジ日時 2023-09-07 22:40:22
合計ジャッジ時間 877 ms
ジャッジサーバーID
(参考情報)
judge3 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

<?php
$N = (int)trim(fgets(STDIN));

$inputs = [];
$input_adds = [];
for ($i = 0; $i<$N; $i++) {
  $input = explode(' ', trim(fgets(STDIN)));
  $inputs[$i] = $input;
  if ($input[4] == 'YES') {
    $input_adds[$i] = 1;
  } else {
    $input_adds[$i] = -1;
  }
}

$score = [];
foreach (range(0, 9) as $key) {
  $score[$key] = 0;
}


foreach ($inputs as $index => $input) {
  $score[$input[0]] += $input_adds[$index];
  $score[$input[1]] += $input_adds[$index];
  $score[$input[2]] += $input_adds[$index];
  $score[$input[3]] += $input_adds[$index];
}

arsort($score);
foreach ($score as $key => $s) {
  echo $key. "\n";
  break;
}
0