結果
| 問題 |
No.27 板の準備
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-02-25 21:29:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 617 bytes |
| コンパイル時間 | 587 ms |
| コンパイル使用メモリ | 51,876 KB |
| 最終ジャッジ日時 | 2024-11-14 19:00:25 |
| 合計ジャッジ時間 | 1,187 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:13: error: ‘vector’ was not declared in this scope
11 | vector<int> dp(100, 100000);
| ^~~~~~
main.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
2 | #include <algorithm>
+++ |+#include <vector>
3 | using namespace std;
main.cpp:11:20: error: expected primary-expression before ‘int’
11 | vector<int> dp(100, 100000);
| ^~~
main.cpp:12:13: error: ‘dp’ was not declared in this scope
12 | dp[0]=0;
| ^~
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int v0, v1, v2, v3;
while (cin>>v0>>v1>>v2>>v3) {
int res=100000;
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(100, 100000);
dp[0]=0;
for(int i=1;i<=30;++i) {
if (i>=a) dp[i]=min(dp[i], dp[i-a]+1);
if (i>=b) dp[i]=min(dp[i], dp[i-b]+1);
if (i>=c) dp[i]=min(dp[i], dp[i-c]+1);
}
res=min(res, dp[v0]+dp[v1]+dp[v2]+dp[v3]);
}
cout<<res<<endl;
}
}
hogeover30