結果

問題 No.29 パワーアップ
ユーザー
提出日時 2016-01-20 22:04:57
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 872 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 32,752 KB
実行使用メモリ 32,876 KB
最終ジャッジ日時 2023-10-21 13:37:04
合計ジャッジ時間 2,082 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
32,612 KB
testcase_01 AC 45 ms
32,612 KB
testcase_02 AC 45 ms
32,612 KB
testcase_03 WA -
testcase_04 AC 44 ms
32,612 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 43 ms
32,612 KB
testcase_08 WA -
testcase_09 AC 44 ms
32,612 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 45 ms
32,616 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 43 ms
32,612 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

$input = trim(fgets(STDIN));

for($j =1; $j <=10; $j ++){
    $itemList[$j] = 0;
}

for($i = 1; $i <= $input; $i ++){
    $inputItem = trim(fgets(STDIN));
    $explode = explode(" ", $inputItem);
    foreach($explode as $explodeKey => $explodeValue){
        foreach($itemList as $itemListKey => $itemListValue){
            if($explodeValue == $itemListKey){
                $itemList[$explodeValue] ++;
            }
        }
    }
}

$answerCount = 0;
$answerAmari = 0;

for($p = 1; $p <= 10; $p ++){
    $itemListAnswer = floor($itemList[$p] / 2);
    if($itemListAnswer >= 1){
       $answerCount += $itemListAnswer;
    }else if($itemListAnswer <= 0){
       $itemListAmariAnswer = floor($itemList[$p] % 2);
       $answerAmari += $itemListAmariAnswer;
    }
}

$answerAmari4 = floor($answerAmari / 4);
$answerCount += $answerAmari4;

echo $answerCount."\n";
0