結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-07 04:34:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 1,105 bytes |
| コンパイル時間 | 1,362 ms |
| コンパイル使用メモリ | 126,720 KB |
| 最終ジャッジ日時 | 2025-01-21 07:51:58 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <unordered_map>
#include <memory.h>
#include <unordered_set>
#include <fstream>
#include <random>
using namespace std;
int dp[31];
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int a, b, c, d;
int res = 1e9;
cin >> a >> b >> c >> d;
for (int i = 1; i <= 30; i++)
{
for (int j = i + 1; j <= 30; j++)
{
for (int k = j + 1; k <= 30; k++)
{
for (int l = 0; l <= 30; l++)
{
dp[l] = 1e5;
}
dp[i] = 1;
dp[j] = 1;
dp[k] = 1;
for (int x = 1; x <= 30; x++)
{
if (dp[x] != 1e5) continue;
for (int y = 1; y < x; y++)
{
dp[x] = min(dp[x], dp[y] + dp[x - y]);
}
}
res = min(res, dp[a] + dp[b] + dp[c] + dp[d]);
}
}
}
cout << res << '\n';
return 0;
}