結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-16 20:35:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 1,092 bytes |
| コンパイル時間 | 747 ms |
| コンパイル使用メモリ | 92,580 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-20 05:19:05 |
| 合計ジャッジ時間 | 1,326 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#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[l]) {
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;
}