結果
| 問題 |
No.32 貯金箱の憂鬱
|
| コンテスト | |
| ユーザー |
bigbear90560
|
| 提出日時 | 2015-07-03 00:36:57 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 141 ms / 5,000 ms |
| コード長 | 984 bytes |
| コンパイル時間 | 3,531 ms |
| コンパイル使用メモリ | 77,884 KB |
| 実行使用メモリ | 54,112 KB |
| 最終ジャッジ日時 | 2024-07-23 02:05:15 |
| 合計ジャッジ時間 | 5,935 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
import java.util.Scanner;
/**
* No.32 貯金箱の憂鬱
*/
public class MelancholyOfPiggyBank {
public static void main(String[] args) {
// 標準入力から読み込む際に、Scannerオブジェクトを使う。
Scanner sc = new Scanner(System.in);
int a = sc.nextInt(); // 100円
int b = sc.nextInt(); // 25円
int c = sc.nextInt(); // 1円
int upCoinNum = 0;
int restCoinNum = 0;
int sumCoinNum = 0;
if (0 != c) {
upCoinNum = (int)Math.floor(c / 25);
restCoinNum = c % 25;
b += upCoinNum;
sumCoinNum += restCoinNum;
}
if (0 != b) {
upCoinNum = (int)Math.floor((b)/ 4);
restCoinNum = b % 4;
a += upCoinNum;
sumCoinNum += restCoinNum;
}
if (0 != a) {
restCoinNum = a % 10;
sumCoinNum += restCoinNum;
}
System.out.println(sumCoinNum);
}
}
bigbear90560