結果
| 問題 |
No.32 貯金箱の憂鬱
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-07 13:20:13 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 701 bytes |
| コンパイル時間 | 634 ms |
| コンパイル使用メモリ | 25,472 KB |
| 実行使用メモリ | 8,608 KB |
| 最終ジャッジ日時 | 2025-03-07 13:20:15 |
| 合計ジャッジ時間 | 1,387 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
#include <stdio.h>
void main(void){
int l = 0 , m = 0 , n = 0 ;
int input = scanf("%d",&l);
if(input == 2){
printf("Lの入力ミス\n");
}
int total = 100*l;
input = scanf("%d",&m);
if(input == 2){
printf("Mの入力ミス\n");
}
total += m*25;
input = scanf("%d",&n);
if(input == 2){
printf("Nの入力ミス\n");
}
total += 1*n;
int thousandYenBill = total / 1000;
int remainingMoney = total - (thousandYenBill*1000);
int coinL = 0;
int coin = 0;
while( remainingMoney >= 100 ){
remainingMoney -= 100;
coin++;
coinL++;
}
int coinM = 0;
while( remainingMoney >= 25 ){
remainingMoney -= 25;
coin++;
coinM++;
}
printf("%d\n",coin+remainingMoney);
}
Maeda