結果
問題 | No.27 板の準備 |
ユーザー |
|
提出日時 | 2024-10-07 23:54:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 574 bytes |
コンパイル時間 | 1,983 ms |
コンパイル使用メモリ | 194,208 KB |
最終ジャッジ日時 | 2025-02-24 16:41:46 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main(){ios::sync_with_stdio(false);cin.tie(nullptr);vector<int> V(4);int an=1e9;for(int i=0;i<4;i++)cin>>V[i];for(int a=1;a<=30;a++)for(int b=1;b<a;b++)for(int c=1;c<b;c++){vector<int> DP(61,3e8);DP[0]=0;for(int j=0;j<30;j++){for(int k:{a,b,c}){DP[j+k]=min(DP[j]+1,DP[j+k]);}}int res=0;for(int j=0;j<4;j++)res+=DP[V[j]];an=min(an,res);}cout<<an<<endl;}