結果

問題 No.27 板の準備
ユーザー cielciel
提出日時 2015-07-14 16:38:41
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 452 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 27,536 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 15:40:59
合計ジャッジ時間 965 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
int main(){
	int V[4],X[3],T=0,R,i,j,r;
	for(i=0;i<4;i++)scanf("%d",&V[i]),T+=V[i];R=T;
	int bag[T+1];
	for(X[0]=1;X[0]<=30;X[0]++)for(X[1]=X[0]+1;X[1]<=30;X[1]++)for(X[2]=X[1]+1;X[2]<=30;X[2]++){
		for(j=0;j<=T;j++)bag[i]=!j;
		for(i=0;i<3;i++)for(int j=X[i];j<=T;j++)if(bag[j-X[i]]&&(!bag[j]||bag[j]>bag[j-X[i]]))bag[j]=bag[j-X[i]]+1;
		for(i=r=0;i<4;r+=bag[V[i++]]-1)if(!bag[V[i]])break;
		if(i==4&&R>r)R=r;
	}
	printf("%d\n",R);
}
0