結果

問題 No.45 回転寿司
ユーザー mbanmban
提出日時 2016-11-02 06:10:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 68 ms / 5,000 ms
コード長 734 bytes
コンパイル時間 2,475 ms
コンパイル使用メモリ 105,984 KB
実行使用メモリ 23,800 KB
最終ジャッジ日時 2023-08-27 15:11:38
合計ジャッジ時間 5,262 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
23,696 KB
testcase_01 AC 65 ms
21,724 KB
testcase_02 AC 63 ms
21,724 KB
testcase_03 AC 63 ms
19,724 KB
testcase_04 AC 63 ms
21,708 KB
testcase_05 AC 56 ms
23,644 KB
testcase_06 AC 64 ms
21,632 KB
testcase_07 AC 64 ms
23,748 KB
testcase_08 AC 62 ms
21,748 KB
testcase_09 AC 64 ms
19,644 KB
testcase_10 AC 64 ms
21,756 KB
testcase_11 AC 62 ms
21,832 KB
testcase_12 AC 62 ms
21,760 KB
testcase_13 AC 56 ms
21,592 KB
testcase_14 AC 58 ms
21,544 KB
testcase_15 AC 63 ms
21,720 KB
testcase_16 AC 62 ms
21,696 KB
testcase_17 AC 64 ms
21,824 KB
testcase_18 AC 65 ms
19,560 KB
testcase_19 AC 64 ms
21,868 KB
testcase_20 AC 57 ms
21,712 KB
testcase_21 AC 55 ms
23,640 KB
testcase_22 AC 57 ms
23,684 KB
testcase_23 AC 57 ms
23,608 KB
testcase_24 AC 56 ms
21,744 KB
testcase_25 AC 54 ms
21,536 KB
testcase_26 AC 64 ms
21,808 KB
testcase_27 AC 64 ms
23,800 KB
testcase_28 AC 62 ms
21,636 KB
testcase_29 AC 65 ms
21,864 KB
testcase_30 AC 68 ms
21,708 KB
testcase_31 AC 54 ms
21,588 KB
testcase_32 AC 55 ms
21,596 KB
testcase_33 AC 64 ms
19,660 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 System.Text;
using System.Threading.Tasks;

class Magatro
{
    
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int[] V = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int[] counter = new int[N];
        counter[0] = V[0];
        if (N == 1)
        {
            Console.WriteLine(V[0]);
            return;
        }
        counter[1] = V[1];
        for(int i = 0; i < N; i++)
        {
            for(int j = i + 2; j < N; j++)
            {
                counter[j] = Math.Max(counter[j], counter[i] + V[j]);
            }
        }
        Console.WriteLine(counter.Max());
    }
}


0