結果
問題 | No.32 貯金箱の憂鬱 |
ユーザー |
|
提出日時 | 2020-06-28 20:54:40 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 56 ms / 5,000 ms |
コード長 | 1,414 bytes |
コンパイル時間 | 3,495 ms |
コンパイル使用メモリ | 77,832 KB |
実行使用メモリ | 50,336 KB |
最終ジャッジ日時 | 2024-07-23 07:57:46 |
合計ジャッジ時間 | 4,814 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
import static java.lang.System.*;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class bankDepression {public static void main(String[] args) throws IOException {InputStreamReader re = new InputStreamReader(System.in);BufferedReader reader = new BufferedReader(new InputStreamReader(in));//String[] inputs = reader.readLine().split(" ");int hundredCoin = Integer.parseInt(reader.readLine());int tfCoin = Integer.parseInt(reader.readLine());int oneCoin = Integer.parseInt(reader.readLine());if(oneCoin >= 25){int changeCount = oneCoinChange(oneCoin);oneCoin -= 25 * changeCount;tfCoin += changeCount;}if(tfCoin >= 4){int changeCount = tfCoinChange(tfCoin);tfCoin -= 4 * changeCount;hundredCoin += changeCount;}if(hundredCoin >= 10){int changeCount = hundredCoinChange(hundredCoin);hundredCoin -= 10 * changeCount;}System.out.println(hundredCoin + tfCoin + oneCoin);}static int oneCoinChange(int oneCoin){int count = 0;while(oneCoin >= 25){oneCoin -= 25;count++;}return count;}static int tfCoinChange(int tfCoin){int count = 0;while(tfCoin >= 4){tfCoin -= 4;count++;}return count;}static int hundredCoinChange(int hundredCoin){int count = 0;while(hundredCoin >= 10){hundredCoin -= 10;count++;}return count;}}