結果

問題 No.45 回転寿司
ユーザー nxterunxteru
提出日時 2017-06-05 23:05:11
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 197 ms / 5,000 ms
コード長 396 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 27,776 KB
実行使用メモリ 65,060 KB
最終ジャッジ日時 2023-08-27 15:29:57
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
13,676 KB
testcase_01 AC 68 ms
25,216 KB
testcase_02 AC 126 ms
43,548 KB
testcase_03 AC 149 ms
52,000 KB
testcase_04 AC 75 ms
27,176 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 53 ms
20,040 KB
testcase_07 AC 123 ms
43,212 KB
testcase_08 AC 16 ms
7,556 KB
testcase_09 AC 144 ms
50,456 KB
testcase_10 AC 36 ms
14,660 KB
testcase_11 AC 11 ms
6,060 KB
testcase_12 AC 135 ms
46,668 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 43 ms
16,904 KB
testcase_16 AC 20 ms
8,852 KB
testcase_17 AC 34 ms
13,504 KB
testcase_18 AC 23 ms
9,296 KB
testcase_19 AC 106 ms
36,652 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,384 KB
testcase_22 AC 0 ms
4,376 KB
testcase_23 AC 0 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 0 ms
4,376 KB
testcase_26 AC 44 ms
17,200 KB
testcase_27 AC 101 ms
35,168 KB
testcase_28 AC 50 ms
19,108 KB
testcase_29 AC 92 ms
30,856 KB
testcase_30 AC 93 ms
32,288 KB
testcase_31 AC 0 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 197 ms
65,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int n,s[1000];
int dp[1000][100000];
int m(int i,int v);
int main(void){
   int i;
   scanf("%d",&n);

   for(i=0;i<n;i++){
       scanf("%d",&s[i]);
   }
    printf("%d",m(0,0));
}
int m(int i,int v){
    if(i>=n)
    return v;
    else if(dp[i][v])
    return dp[i][v];
    else{
    int x=m(i+2,v+s[i]);
    int y=m(i+1,v);
    dp[i][v]=x>y?x:y;
    return dp[i][v];
    }
}
0