結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
togatoga
|
| 提出日時 | 2015-04-20 00:02:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,671 bytes |
| コンパイル時間 | 865 ms |
| コンパイル使用メモリ | 91,252 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 19:02:26 |
| 合計ジャッジ時間 | 1,471 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 18 |
ソースコード
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <algorithm>
#include <functional>
#include <limits.h>
#include <bitset>
#include <tuple>
#include <unordered_map>
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int INF = 1 << 29;
const double EPS = 1e-9;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
vector<int> V;
int dp[50];
int main() {
for (int i = 0; i < 4; i++) {
int x;
cin >> x;
V.push_back(x);
}
int res = INF;
for (int A = 1; A <= 30; A++) {
for (int B = A + 1; B <= 30; B++) {
for (int C = B + 1; C <= 30; C++) {
fill(dp, dp + 50, INF);
dp[A] = 1;
dp[B] = 1;
dp[C] = 1;
// cout << A << " " << B << " " << C << endl;
for (int k = 1; k <= 30; k++) {
if (k - A >= 0 and dp[k - A] != INF) {
dp[k] = min(dp[k], dp[k - A] + 1);
}
if (k - B >= 0 and dp[k - B] != INF) {
dp[k] = min(dp[k], dp[k - B] + 1);
}
if (k - C >= 0 and dp[k - C] != INF) {
dp[k] = min(dp[k], dp[k - C] + 1);
}
}
int tmp = 0;
for (int i = 0; i < V.size(); i++) {
tmp += dp[V[i]];
}
res = min(res, tmp);
}
}
}
cout << res << endl;
return 0;
}
togatoga