結果

問題 No.24 数当てゲーム
コンテスト
ユーザー jshimazu0820
提出日時 2014-11-23 15:51:50
言語 PHP
(8.5.2)
コンパイル:
php -l _filename_
実行:
php _filename_
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 663 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 551 ms
コンパイル使用メモリ 38,172 KB
実行使用メモリ 38,384 KB
最終ジャッジ日時 2026-03-04 15:44:10
合計ジャッジ時間 1,195 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #
raw source code

<?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