結果

問題 No.32 貯金箱の憂鬱
コンテスト
ユーザー でばら焼肉のたれ
提出日時 2026-08-25 16:45:09
言語 C
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 0 ms / 5,000 ms
+ 812µs
コード長 479 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 793 ms
コンパイル使用メモリ 37,376 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-25 16:45:12
合計ジャッジ時間 1,865 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>


void change(int *large_pcs, int *small_pcs, int late)
{
	*large_pcs += *small_pcs / late;
	*small_pcs %= late;
}


int main(void)
{
	int lmn[4] = {0};
	int i;
	int total = 0;

	for (i = 1; i < 4; i++) {
		do {
			scanf("%d", &lmn[i]);
		} while (lmn[i] < 0 || lmn[i] > 1000);
	}

	change(&lmn[2], &lmn[3], 25);
	change(&lmn[1], &lmn[2],  4);
	change(&lmn[0], &lmn[1], 10);
	
	for (i = 1; i < 4; i++)
		total += lmn[i];

	printf("%d\n", total);

	return 0;
}
0