結果

問題 No.29 パワーアップ
ユーザー papinianuspapinianus
提出日時 2016-06-02 17:21:21
言語 PHP
(8.2.11)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 407 bytes
コンパイル時間 1,230 ms
コンパイル使用メモリ 18,472 KB
実行使用メモリ 18,912 KB
最終ジャッジ日時 2023-07-29 17:42:16
合計ジャッジ時間 2,911 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
18,872 KB
testcase_01 AC 14 ms
18,912 KB
testcase_02 AC 13 ms
18,848 KB
testcase_03 AC 12 ms
18,816 KB
testcase_04 AC 13 ms
18,828 KB
testcase_05 AC 13 ms
18,868 KB
testcase_06 AC 13 ms
18,684 KB
testcase_07 AC 13 ms
18,812 KB
testcase_08 AC 13 ms
18,868 KB
testcase_09 AC 13 ms
18,872 KB
testcase_10 AC 13 ms
18,844 KB
testcase_11 AC 13 ms
18,800 KB
testcase_12 AC 13 ms
18,828 KB
testcase_13 AC 13 ms
18,680 KB
testcase_14 AC 14 ms
18,912 KB
testcase_15 AC 13 ms
18,852 KB
testcase_16 AC 13 ms
18,844 KB
testcase_17 AC 13 ms
18,880 KB
testcase_18 AC 12 ms
18,780 KB
testcase_19 AC 12 ms
18,816 KB
testcase_20 AC 13 ms
18,852 KB
testcase_21 AC 13 ms
18,824 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$items = array_fill(0, 11, 0);
$count = trim(fgets(STDIN));
$total = 3*$count;
$pwrUp = 0;
while($count) {
    list($item1, $item2, $item3) = explode(' ', trim(fgets(STDIN)));
    $items[$item1]++;
    $items[$item2]++;
    $items[$item3]++;
    $count--;
}
for($i = 1; $i <= 10; $i++) {
    $pwrUp += floor($items[$i]/2);
}
$rest = $total - $pwrUp * 2;
$pwrUp += floor($rest/4);
echo $pwrUp.PHP_EOL;
0