結果

問題 No.45 回転寿司
ユーザー ooh_23ooh_23
提出日時 2018-01-29 14:58:26
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,118 bytes
コンパイル時間 2,060 ms
コンパイル使用メモリ 102,308 KB
実行使用メモリ 23,660 KB
最終ジャッジ日時 2023-08-28 15:19:55
合計ジャッジ時間 5,468 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
21,652 KB
testcase_01 AC 65 ms
19,676 KB
testcase_02 AC 66 ms
21,520 KB
testcase_03 AC 66 ms
19,424 KB
testcase_04 AC 65 ms
21,592 KB
testcase_05 AC 59 ms
21,500 KB
testcase_06 AC 66 ms
21,476 KB
testcase_07 AC 67 ms
23,576 KB
testcase_08 AC 65 ms
21,704 KB
testcase_09 AC 65 ms
21,572 KB
testcase_10 AC 66 ms
23,500 KB
testcase_11 AC 65 ms
21,560 KB
testcase_12 AC 67 ms
19,672 KB
testcase_13 AC 59 ms
21,444 KB
testcase_14 AC 58 ms
19,392 KB
testcase_15 AC 66 ms
23,624 KB
testcase_16 AC 65 ms
23,644 KB
testcase_17 AC 66 ms
21,668 KB
testcase_18 AC 65 ms
21,528 KB
testcase_19 AC 66 ms
21,540 KB
testcase_20 AC 59 ms
21,536 KB
testcase_21 AC 57 ms
19,432 KB
testcase_22 AC 58 ms
23,532 KB
testcase_23 AC 58 ms
19,436 KB
testcase_24 AC 57 ms
21,416 KB
testcase_25 RE -
testcase_26 AC 65 ms
21,524 KB
testcase_27 AC 65 ms
21,472 KB
testcase_28 AC 65 ms
19,412 KB
testcase_29 AC 66 ms
23,660 KB
testcase_30 AC 67 ms
21,536 KB
testcase_31 AC 59 ms
21,452 KB
testcase_32 AC 58 ms
21,608 KB
testcase_33 AC 65 ms
21,584 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.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication6
{
    class Program
    {
        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int[] A = new int[N];
            int[] B = new int[N];
            string[] row = Console.ReadLine().Split();
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(row[i]);
            }

            B[0] = A[0];
            B[1] = A[1];

            if(N == 1)
            {
                Console.WriteLine(A[0]);
                return;
            }

            for (int i = 0; i < N - 2; i++)
            {
                if (i + 2 < N && B[i+2] < B[i] + A[i+2])
                {
                    B[i + 2] = B[i] + A[i + 2];
                }
                if (i + 3 < N && B[i] < B[i] + A[i + 3])
                {
                    B[i + 3] = B[i] + A[i + 3];
                }
            }

                Console.WriteLine(B.Max());
        }
    }
}
0