結果
問題 |
No.27 板の準備
|
ユーザー |
![]() |
提出日時 | 2016-09-27 22:05:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 628 bytes |
コンパイル時間 | 585 ms |
コンパイル使用メモリ | 64,532 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-21 07:23:39 |
合計ジャッジ時間 | 1,200 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 18 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int DP[61]; int main() { for (int j = 0; j < 61; j++)DP[j] = INT32_MAX; vector<int>v(4),n(4); cin >> v[0] >> v[1] >> v[2] >> v[3]; DP[0] = 0; int ans = 1; for (int i = 0; i < 3; i++) { for (int j = 0; j < 31; j++) { if (DP[j] == INT32_MAX)continue; DP[j + v[i]] = min(DP[j + v[i]], DP[j] + 1); } n[i+1] = DP[v[i+1]]; cout << n[i+1] << endl; if (n[i + 1] == INT32_MAX)ans++; } sort(n.begin(), n.end()); int nok = 4 - ans; for (int i = 1; i < nok; i++) { ans += n[i]; } ans++; cout << ans << endl; return 0; }