結果
| 問題 |
No.24 数当てゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-05 12:16:56 |
| 言語 | PHP (843.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 938 bytes |
| コンパイル時間 | 2,478 ms |
| コンパイル使用メモリ | 29,948 KB |
| 実行使用メモリ | 30,904 KB |
| 最終ジャッジ日時 | 2024-07-05 19:07:48 |
| 合計ジャッジ時間 | 3,418 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 1 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php
$turn_max = trim(fgets(STDIN));
$pos_array = array();
$neg_array = array();
$yes_time = 0;
for ( $turn=0; $turn<$turn_max; $turn++ ) {
list($num_array[0], $num_array[1], $num_array[2], $num_array[3], $ans) = explode(" ", trim(fgets(STDIN)));
array_unique($num_array);
if ( strcmp($ans, 'YES') == 0 ) {
$pos_array = array_merge($pos_array, $num_array);
$yes_time++;
}
else {
$neg_array = array_merge($neg_array, $num_array);
}
}
$result = -1;
array_unique($neg_array);
if ( count($neg_array) >= 9 ) {
for ( $needle=0; $needle<=9; $needle++ ) {
if ( array_search($needle, $neg_array) === FALSE ) {
$result = $needle;
break;
}
}
}
if ( $result == -1 ) {
$count_array = array_count_values($pos_array);
$max_count = 0;
foreach ( $count_array as $num => $count ) {
if ( ($count == $yes_time) && (array_search($num, $neg_array) === FALSE) ) {
$max_count++;
$result = $num;
}
}
}
echo $result.PHP_EOL;