結果

問題 No.32 貯金箱の憂鬱
ユーザー scache
提出日時 2014-10-01 00:36:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 771 ms / 5,000 ms
コード長 605 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 54,976 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 02:00:11
合計ジャッジ時間 11,094 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

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