結果
| 問題 | 
                            No.29 パワーアップ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-01-20 22:23:53 | 
| 言語 | PHP  (843.2)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 54 ms / 5,000 ms | 
| コード長 | 1,050 bytes | 
| コンパイル時間 | 383 ms | 
| コンパイル使用メモリ | 36,028 KB | 
| 実行使用メモリ | 36,628 KB | 
| 最終ジャッジ日時 | 2025-10-24 20:55:55 | 
| 合計ジャッジ時間 | 2,127 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?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($itemList[$p] % 2 !== 0){
       $answerCount += $itemListAnswer;
       $answerAmari += $itemList[$p] - ($itemListAnswer * 2);
    }else if($itemListAnswer >= 1){
       $answerCount += $itemListAnswer;
    }else if($itemListAnswer <= 0){
       $itemListAmariAnswer = floor($itemList[$p] % 2);
       $answerAmari += $itemListAmariAnswer;
    }else{
       $answerAmari += 1;
    }
}
$answerAmari4 = floor($answerAmari / 4);
$answerCount += $answerAmari4;
echo $answerCount."\n";