結果

問題 No.27 板の準備
ユーザー
提出日時 2020-12-16 20:34:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,092 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 93,116 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-20 05:19:03
合計ジャッジ時間 1,604 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main(){
	int v[4];
	cin >> v[0] >> v[1] >> v[2] >> v[3];
	int ans = 10007;
	for (int i = 1; i <= 30; i++) {
		for (int j = i + 1; j <= 30; j++) {
			for (int k = j + 1; k <= 30; k++) {
				int ans1 = 0;
				for (int l = 0; l < 4; l++) {
					int co = 10007;
					for (int a = 0; a <= 30; a++) {
						if (a * i > v[i]) {
							break;
						}
						for (int b = 0; b <= 30; b++) {
							if (a * i + b * j > v[l]) {
								break;
							}
							for (int c = 0; c <= 30; c++) {
								if (a * i + b * j + c * k > v[l]) {
									break;
								}
								if (a * i + b * j + c * k == v[l]) {
									if (co > a + b + c) {
										co = a + b + c;
									}
								}
							}
						}
					}
					ans1 += co;
				}
				if (ans > ans1) {
					ans = ans1;
				}
			}
		} 
	}
	cout << ans << endl;
}
0