結果

問題 No.29 パワーアップ
ユーザー papinianuspapinianus
提出日時 2016-06-02 17:21:21
言語 PHP
(8.3.4)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 407 bytes
コンパイル時間 1,315 ms
コンパイル使用メモリ 30,884 KB
実行使用メモリ 31,412 KB
最終ジャッジ日時 2024-04-16 23:09:26
合計ジャッジ時間 3,524 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
31,112 KB
testcase_01 AC 41 ms
31,212 KB
testcase_02 AC 41 ms
31,128 KB
testcase_03 AC 41 ms
31,148 KB
testcase_04 AC 41 ms
31,140 KB
testcase_05 AC 41 ms
31,252 KB
testcase_06 AC 41 ms
31,412 KB
testcase_07 AC 40 ms
30,952 KB
testcase_08 AC 41 ms
30,964 KB
testcase_09 AC 41 ms
31,184 KB
testcase_10 AC 41 ms
31,120 KB
testcase_11 AC 40 ms
30,844 KB
testcase_12 AC 41 ms
30,996 KB
testcase_13 AC 41 ms
30,956 KB
testcase_14 AC 41 ms
30,960 KB
testcase_15 AC 41 ms
30,976 KB
testcase_16 AC 41 ms
30,980 KB
testcase_17 AC 41 ms
31,052 KB
testcase_18 AC 41 ms
31,176 KB
testcase_19 AC 41 ms
31,032 KB
testcase_20 AC 41 ms
31,044 KB
testcase_21 AC 41 ms
31,316 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