結果

問題 No.32 貯金箱の憂鬱
ユーザー jake_tarojake_taro
提出日時 2015-09-07 14:19:39
言語 PHP
(8.3.4)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 548 bytes
コンパイル時間 1,155 ms
コンパイル使用メモリ 18,280 KB
実行使用メモリ 18,868 KB
最終ジャッジ日時 2023-09-30 07:55:27
合計ジャッジ時間 1,041 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
18,868 KB
testcase_01 AC 16 ms
18,700 KB
testcase_02 AC 16 ms
18,816 KB
testcase_03 AC 15 ms
18,696 KB
testcase_04 AC 16 ms
18,768 KB
testcase_05 AC 15 ms
18,800 KB
testcase_06 AC 16 ms
18,740 KB
testcase_07 AC 15 ms
18,776 KB
testcase_08 AC 15 ms
18,812 KB
testcase_09 AC 15 ms
18,736 KB
testcase_10 AC 16 ms
18,700 KB
testcase_11 AC 16 ms
18,836 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
/*両替問題*/

foreach(range(1,3) as $key => $value){
	$money[] = trim(fgets(STDIN));
}
$L = $money[0]; // 100円硬貨の枚数
$M = $money[1]; // 25円硬貨の枚数
$N = $money[2]; // 1円硬貨の枚数

$S = 0; //1000円札の枚数

$sub_N = floor($N / 25);
$mod_N = $N % 25;

if($sub_N > 0){
	$M += $sub_N;
	$N = $mod_N;
}
$sub_M = floor($M / 4);
$mod_M = $M % 4;

if($sub_M > 0){
	$L += $sub_M;
	$M = $mod_M;
}
$sub_L = floor($L / 10);
$mod_L = $L % 10;

if($sub_L > 0){
	$S += $sub_L;
	$L = $mod_L;
}

echo $L + $M + $N, PHP_EOL;
0