結果

問題 No.32 貯金箱の憂鬱
ユーザー mondomondo
提出日時 2019-07-24 16:11:08
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 46 ms
コンパイル使用メモリ 12,076 KB
実行使用メモリ 12,368 KB
最終ジャッジ日時 2023-09-10 10:19:06
合計ジャッジ時間 916 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
12,280 KB
testcase_01 AC 7 ms
12,216 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

// 位の硬貨は下位の硬貨の整数倍になっているので、
// 合計金額を計算し、1000円札は計算に含めないので1000で余りを取った残りを、
// 金額が大きい硬貨から順に取れるだけ取ればよいです。
while($line =fgets(STDIN)){
    $array[] = trim($line);
}
$m100 = $array[0]*100;
$m25 = $array[1]*25;
$m1 = $array[2]*1;

$money =($m100 + $m25 + $m1) % 1000;
$ans1 = floor($money / 100) ;
$ans2 = floor(($money % 100)/25);
$ans3 = floor((($money % 100)/25))/1;
echo $answer = $ans1 + $ans2 + $ans3 + $m1;
0