結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-16 18:43:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 722 bytes |
| コンパイル時間 | 1,879 ms |
| コンパイル使用メモリ | 198,196 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-05-16 18:43:59 |
| 合計ジャッジ時間 | 3,069 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
vector<int> V(4);
for(auto &v : V) cin >> v;
int answer = 1001001001;
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> dp(31,101001001);
dp.at(0) = 0;
for(int i=0; i<30; i++){
if(i+a <= 30) dp.at(i+a) = min(dp.at(i+a),dp.at(i)+1);
if(i+b <= 30) dp.at(i+b) = min(dp.at(i+b),dp.at(i)+1);
if(i+c <= 30) dp.at(i+c) = min(dp.at(i+c),dp.at(i)+1);
}
int now = 0;
for(auto v : V) now += dp.at(v);
answer = min(answer,now);
}
cout << answer << endl;
}