結果

問題 No.27 板の準備
ユーザー 夜
提出日時 2020-12-16 20:34:01
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,092 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 92,472 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 09:49:39
合計ジャッジ時間 1,816 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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