結果

問題 No.29 パワーアップ
ユーザー papinianus
提出日時 2016-06-02 17:21:21
言語 PHP
(843.2)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 407 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 32,148 KB
実行使用メモリ 32,404 KB
最終ジャッジ日時 2024-10-08 05:37:55
合計ジャッジ時間 2,102 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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