結果

問題 No.45 回転寿司
ユーザー NoNo
提出日時 2017-05-29 23:09:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 730 bytes
コンパイル時間 3,379 ms
コンパイル使用メモリ 105,552 KB
実行使用メモリ 25,676 KB
最終ジャッジ日時 2023-08-27 15:28:12
合計ジャッジ時間 5,242 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
23,776 KB
testcase_01 AC 61 ms
21,872 KB
testcase_02 AC 62 ms
21,900 KB
testcase_03 AC 63 ms
21,852 KB
testcase_04 AC 62 ms
21,820 KB
testcase_05 AC 54 ms
21,648 KB
testcase_06 AC 58 ms
21,788 KB
testcase_07 AC 61 ms
23,712 KB
testcase_08 AC 60 ms
21,748 KB
testcase_09 AC 62 ms
21,740 KB
testcase_10 AC 63 ms
21,868 KB
testcase_11 AC 58 ms
23,768 KB
testcase_12 AC 61 ms
19,724 KB
testcase_13 AC 57 ms
25,676 KB
testcase_14 AC 56 ms
23,624 KB
testcase_15 AC 64 ms
21,840 KB
testcase_16 AC 62 ms
21,724 KB
testcase_17 AC 62 ms
21,836 KB
testcase_18 AC 61 ms
21,844 KB
testcase_19 AC 61 ms
21,876 KB
testcase_20 AC 55 ms
21,716 KB
testcase_21 AC 56 ms
21,760 KB
testcase_22 AC 56 ms
23,732 KB
testcase_23 AC 56 ms
23,704 KB
testcase_24 AC 54 ms
23,672 KB
testcase_25 AC 52 ms
23,760 KB
testcase_26 AC 60 ms
23,864 KB
testcase_27 AC 61 ms
23,912 KB
testcase_28 AC 62 ms
23,792 KB
testcase_29 AC 60 ms
21,868 KB
testcase_30 AC 61 ms
21,872 KB
testcase_31 AC 55 ms
21,744 KB
testcase_32 AC 55 ms
19,608 KB
testcase_33 AC 62 ms
21,744 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.Linq;
namespace Yuki
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] v = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();

            int ma = 0;
            int mb = 0;

            for (int i = 0; i < n; i++)
            {
                int a = ma;
                int b = mb;

                if (mb + v[i] > a)
                {
                    ma = mb + v[i];
                }

                if (a > b)
                {
                    mb = a;
                }
            }
            int ans = ma > mb ? ma : mb;

            Console.WriteLine(ans);
        }
    }
}
0