結果

問題 No.45 回転寿司
ユーザー masaktmasakt
提出日時 2017-04-03 02:22:59
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 767 bytes
コンパイル時間 3,633 ms
コンパイル使用メモリ 102,300 KB
実行使用メモリ 22,964 KB
最終ジャッジ日時 2023-09-22 08:01:00
合計ジャッジ時間 6,335 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
20,776 KB
testcase_01 AC 65 ms
20,788 KB
testcase_02 AC 63 ms
20,748 KB
testcase_03 AC 64 ms
22,648 KB
testcase_04 AC 64 ms
22,764 KB
testcase_05 AC 56 ms
20,676 KB
testcase_06 AC 63 ms
20,784 KB
testcase_07 AC 66 ms
22,768 KB
testcase_08 AC 62 ms
18,852 KB
testcase_09 AC 65 ms
22,964 KB
testcase_10 AC 65 ms
20,780 KB
testcase_11 AC 62 ms
20,788 KB
testcase_12 AC 64 ms
18,856 KB
testcase_13 AC 57 ms
20,648 KB
testcase_14 AC 57 ms
20,804 KB
testcase_15 AC 64 ms
20,836 KB
testcase_16 AC 62 ms
18,860 KB
testcase_17 AC 64 ms
20,748 KB
testcase_18 AC 63 ms
20,772 KB
testcase_19 AC 63 ms
20,784 KB
testcase_20 AC 56 ms
20,656 KB
testcase_21 AC 57 ms
20,656 KB
testcase_22 AC 57 ms
20,624 KB
testcase_23 AC 58 ms
22,560 KB
testcase_24 AC 57 ms
20,616 KB
testcase_25 AC 55 ms
18,744 KB
testcase_26 AC 63 ms
20,788 KB
testcase_27 AC 62 ms
18,820 KB
testcase_28 AC 64 ms
20,744 KB
testcase_29 AC 64 ms
20,840 KB
testcase_30 AC 68 ms
20,852 KB
testcase_31 AC 55 ms
20,820 KB
testcase_32 AC 56 ms
20,812 KB
testcase_33 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class P
{
    static int Search(int i)
    {
        if (dp[i] > 0)
        {
            return dp[i];
        }
        int res = 0;
        if(i >= n)
        {
            res = 0;
        }
        else
        {
            res = Math.Max(Search(i + 2), Search(i + 3)) + V[i];
        }
        return dp[i] = res;
    }
    static int n;
    static int[] V = new int[1000];
    static int[] dp = new int[1000];

    static void Main(string[]_)
    {
        n = int.Parse(Console.ReadLine());
        _=Console.ReadLine().Split(' ');
        for (int i = 0; i < n; i++)
        {
            V[i] = int.Parse(_[i]);
        }
        Console.WriteLine(Math.Max(Search(0),Search(1)));
    }
}
0