結果
問題 | No.29 パワーアップ |
ユーザー |
|
提出日時 | 2015-05-11 13:12:24 |
言語 | PHP (843.2) |
結果 |
AC
|
実行時間 | 37 ms / 5,000 ms |
コード長 | 418 bytes |
コンパイル時間 | 1,960 ms |
コンパイル使用メモリ | 30,548 KB |
実行使用メモリ | 31,376 KB |
最終ジャッジ日時 | 2024-07-05 22:58:53 |
合計ジャッジ時間 | 3,747 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $num = trim(fgets(STDIN)); $array = array(); for ( $in=0; $in<$num; $in++ ) { $array = array_merge($array, explode(" ", trim(fgets(STDIN)))); } $count = array_count_values($array); $items = count($array); $powerup = 0; foreach ( $count as $index => $value ) { if ( $value >= 2 ) { $use = floor($value / 2); $items -= $use*2; $powerup += $use; } } $powerup += floor($items / 4); echo $powerup.PHP_EOL;