結果

問題 No.32 貯金箱の憂鬱
ユーザー scachescache
提出日時 2014-10-01 00:36:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 768 ms / 5,000 ms
コード長 605 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 51,908 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 07:46:24
合計ジャッジ時間 11,086 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 767 ms
4,376 KB
testcase_01 AC 766 ms
4,380 KB
testcase_02 AC 765 ms
4,376 KB
testcase_03 AC 768 ms
4,380 KB
testcase_04 AC 766 ms
4,380 KB
testcase_05 AC 765 ms
4,380 KB
testcase_06 AC 767 ms
4,380 KB
testcase_07 AC 767 ms
4,380 KB
testcase_08 AC 767 ms
4,376 KB
testcase_09 AC 767 ms
4,376 KB
testcase_10 AC 765 ms
4,376 KB
testcase_11 AC 764 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

#define MAX 100*1000+25*1000+1*1000
int memo[MAX+1];
int main() {
	// your code goes here
	
	int l,m,n;
	cin >>l >>m >>n;
	
	for(int i=0;i<=MAX;i++)
		memo[i] = 10000000;
		
	int hy = 0;
	int ty = 0;
	int oy = 0;
	for(int i=0;i<=1000;i++){
		ty = hy;
		for(int j=0;j<=1000;j++){
			oy = ty;
			for(int k=0;k<=1000;k++){
				memo[oy] = memo[oy] > i+j+k ? i+j+k : memo[oy];
				oy += 1;
			}
			
			ty+= 25;
		}
		hy+= 100;
	}
		
	int res = 1000000;
	for(int i=l*100+m*25+n; i>=0;i-=1000 )
		res = memo[i] < res ? memo[i] : res;
	
	cout << res << endl;
	return 0;
}
0