結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
sugim48
|
| 提出日時 | 2014-12-19 11:06:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 1,249 bytes |
| コンパイル時間 | 928 ms |
| コンパイル使用メモリ | 91,276 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 10:27:07 |
| 合計ジャッジ時間 | 1,866 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<int, ll> i_ll;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int main() {
vector<int> V(4);
cin >> V[0] >> V[1] >> V[2] >> V[3];
int mini = INT_MAX;
for (int A = 1; A <= 30; A++)
for (int B = A + 1; B <= 30; B++)
for (int C = B + 1; C <= 30; C++) {
vector<int> a(31, INT_MAX / 10);
a[0] = 0;
for (int i = 1; i <= 30; i++) {
if (i >= A) a[i] = min(a[i], a[i - A] + 1);
if (i >= B) a[i] = min(a[i], a[i - B] + 1);
if (i >= C) a[i] = min(a[i], a[i - C] + 1);
}
int sum = 0;
for (int j = 0; j < 4; j++)
sum += a[V[j]];
mini = min(mini, sum);
}
cout << mini << endl;
}
sugim48