結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
Bantako
|
| 提出日時 | 2018-06-16 20:08:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 620 bytes |
| コンパイル時間 | 1,827 ms |
| コンパイル使用メモリ | 167,344 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 13:32:02 |
| 合計ジャッジ時間 | 2,883 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
7 | main(){
| ^~~~
ソースコード
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 28) - 1;
int MOD = 1e9+7;
main(){
int V[4],num[3];
rep(i,0,4)cin >> V[i];
int ans = INF;
rep(i,1,31)rep(j,i+1,31)rep(k,j+1,31){
num[0] = i;
num[1] = j;
num[2] = k;
vector<int> dp(31,INF);
dp[0] = 0;
rep(l,0,31)rep(m,0,3){
if(l < num[m])continue;
dp[l] = min(dp[l], dp[l - num[m]] + 1);
}
ans = min(ans, dp[V[0]] + dp[V[1]] + dp[V[2]] + dp[V[3]] );
}
cout << ans << endl;
}
Bantako