結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
nmnmnmnmnmnmnm
|
| 提出日時 | 2014-10-05 22:37:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 117 ms / 5,000 ms |
| コード長 | 1,262 bytes |
| コンパイル時間 | 991 ms |
| コンパイル使用メモリ | 86,280 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 10:25:42 |
| 合計ジャッジ時間 | 4,064 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
/*
1.txt
1 1 1 1
4
2.txt
2 2 3 4
4
3.txt
3 3 3 29
4
4.txt
4 4 8 8
4
5.txt
5 17 22 24
5
6.txt
14 16 17 20
7
7.txt
20 23 24 25
7
8.txt
13 21 27 29
7
9.txt
27 28 29 30
6
10.txt
18 24 25 29
9
*/
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
int main(){
int v[4];
cin >> v[0] >> v[1] >> v[2] >> v[3];
int mn = 100000;
rep(a,1,31){
rep(b,1,31){
rep(c,1,31){
int dp[10000];
rep(i,0,10000)dp[i]=10000;
dp[0] = 0;
rep(i,0,31){
dp[i+a]=min(dp[i+a],dp[i]+1);
dp[i+b]=min(dp[i+b],dp[i]+1);
dp[i+c]=min(dp[i+c],dp[i]+1);
}
mn = min(mn,dp[v[0]]+dp[v[1]]+dp[v[2]]+dp[v[3]]);
}
}
}
cout << mn << endl;
return 0;
}
nmnmnmnmnmnmnm