結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2022-12-19 12:38:32 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 5,000 ms |
| コード長 | 899 bytes |
| コンパイル時間 | 1,158 ms |
| コンパイル使用メモリ | 142,952 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 00:53:02 |
| 合計ジャッジ時間 | 2,090 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
using namespace std;
int solve(int i, int j, int k, int a){
int mi = 100, b;
for (int n=0; n<=30; n++){
for (int m=0; m<=30; m++){
b = a;
b -= n*i+m*j;
if (b >= 0 && b % k == 0) mi = min(n+m+b/k, mi);
}
}
return mi;
}
int main(){
int ans=1e9, tot;
vector<int> a(4);
for (int i=0; i<4; i++) cin >> a[i];
for (int i=1; i<=30; i++){
for (int j=i+1; j<=30; j++){
for (int k=j+1; k<=30; k++){
tot = 0;
for (int l=0; l<4; l++) tot += solve(i, j, k, a[l]);
ans = min(tot, ans);
}
}
}
cout << ans << endl;
return 0;
}
srjywrdnprkt