結果

問題 No.45 回転寿司
ユーザー iwkjoseciwkjosec
提出日時 2019-10-03 22:57:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 566 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 112,336 KB
実行使用メモリ 27,928 KB
最終ジャッジ日時 2024-04-14 09:44:45
合計ジャッジ時間 2,994 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
23,472 KB
testcase_01 AC 33 ms
27,600 KB
testcase_02 AC 33 ms
25,428 KB
testcase_03 AC 33 ms
27,800 KB
testcase_04 AC 32 ms
25,764 KB
testcase_05 AC 28 ms
25,224 KB
testcase_06 AC 32 ms
27,824 KB
testcase_07 AC 32 ms
25,764 KB
testcase_08 AC 32 ms
23,472 KB
testcase_09 AC 33 ms
27,928 KB
testcase_10 AC 32 ms
27,472 KB
testcase_11 AC 33 ms
25,776 KB
testcase_12 AC 32 ms
27,596 KB
testcase_13 AC 29 ms
25,380 KB
testcase_14 AC 28 ms
27,168 KB
testcase_15 AC 32 ms
25,424 KB
testcase_16 AC 33 ms
25,508 KB
testcase_17 AC 34 ms
25,640 KB
testcase_18 AC 33 ms
27,672 KB
testcase_19 AC 32 ms
27,596 KB
testcase_20 AC 28 ms
25,384 KB
testcase_21 AC 28 ms
25,096 KB
testcase_22 AC 28 ms
25,224 KB
testcase_23 AC 27 ms
25,380 KB
testcase_24 AC 29 ms
27,144 KB
testcase_25 AC 28 ms
25,384 KB
testcase_26 AC 32 ms
27,728 KB
testcase_27 AC 33 ms
25,768 KB
testcase_28 AC 33 ms
25,552 KB
testcase_29 AC 32 ms
25,508 KB
testcase_30 AC 32 ms
25,636 KB
testcase_31 AC 28 ms
25,008 KB
testcase_32 AC 29 ms
27,140 KB
testcase_33 AC 33 ms
25,764 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var n = int.Parse(ReadLine());
        var v = ReadLine().Split().Select(int.Parse).ToArray();
        var dp = new int[n, 2];
        dp[0, 0] = 0;
        dp[0, 1] = v[0];
        for (int i = 1; i < n; i++)
        {
            dp[i, 0] = Max(dp[i - 1, 0], dp[i - 1, 1]);
            dp[i, 1] = dp[i - 1, 0] + v[i];
        }
        WriteLine(Max(dp[n - 1, 0], dp[n - 1, 1]));
    }
}
0