結果
問題 |
No.27 板の準備
|
ユーザー |
![]() |
提出日時 | 2016-09-27 22:16:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 774 bytes |
コンパイル時間 | 548 ms |
コンパイル使用メモリ | 64,400 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 07:24:01 |
合計ジャッジ時間 | 1,284 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 8 |
ソースコード
#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]; sort(v.begin(), v.end()); int a = v[0]; for (int i = 1; i < 4; i++) { if (v[i] == a) { cout << 4 << endl; return 0; } a = v[i]; } DP[0] = 0; int ans = 3; 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 = 3 - ans; //for (int i = 1; i <= nok; i++) { ans += n[1]; //} cout << ans << endl; return 0; }