結果

問題 No.27 板の準備
ユーザー aggai_msm04aggai_msm04
提出日時 2015-04-24 01:48:58
言語 C++11
(gcc 11.4.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 730 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 51,368 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-27 03:26:30
合計ジャッジ時間 3,450 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int f(int, int, int)’:
main.cpp:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^

ソースコード

diff #

#include<iostream>
using namespace std;
int v[4];
int dp[32];
int f( int i, int j, int k){
  for( int l=0;l<=30;l++)dp[l]=0x1fffffff-30;
  dp[0]=0;
  for( int l = 1;l<=30;l++){
    if(i<=l)dp[l]=min(dp[l],dp[l-i]+1);
    if(j<=l)dp[l]=min(dp[l],dp[l-j]+1);
    if(k<=l)dp[l]=min(dp[l],dp[l-k]+1);
  }
}
    
int main(void){
  cin>>v[0]>>v[1]>>v[2]>>v[3];
  int res = 200;
  for(int i=1;i<=30;i++){
    for(int j=i+1;j<=30;j++){
      for(int k=j+1;k<=30;k++){
        f(i,j,k);
        res = min(res, dp[v[0]]+dp[v[1]]+dp[v[2]]+dp[v[3]]);

        //        for( int l = 0;l <= 30;l++)cout<<dp[l]<<" ";
        //        cout<<endl;
        //        cout<<"res = "<<res<<endl;

      }
    }
  }
  cout<<res<<endl;
  return 0;
}
0