結果

問題 No.45 回転寿司
ユーザー NoNo
提出日時 2017-05-31 22:22:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 71 ms / 5,000 ms
コード長 584 bytes
コンパイル時間 3,254 ms
コンパイル使用メモリ 101,324 KB
実行使用メモリ 23,996 KB
最終ジャッジ日時 2023-08-27 15:29:38
合計ジャッジ時間 6,962 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
21,688 KB
testcase_01 AC 70 ms
23,728 KB
testcase_02 AC 71 ms
21,916 KB
testcase_03 AC 71 ms
23,756 KB
testcase_04 AC 71 ms
21,852 KB
testcase_05 AC 62 ms
23,692 KB
testcase_06 AC 70 ms
21,708 KB
testcase_07 AC 70 ms
21,756 KB
testcase_08 AC 69 ms
21,772 KB
testcase_09 AC 71 ms
21,788 KB
testcase_10 AC 71 ms
23,996 KB
testcase_11 AC 68 ms
19,796 KB
testcase_12 AC 71 ms
23,836 KB
testcase_13 AC 61 ms
21,612 KB
testcase_14 AC 62 ms
21,600 KB
testcase_15 AC 70 ms
21,744 KB
testcase_16 AC 69 ms
21,740 KB
testcase_17 AC 69 ms
21,752 KB
testcase_18 AC 69 ms
21,736 KB
testcase_19 AC 70 ms
23,740 KB
testcase_20 AC 62 ms
21,656 KB
testcase_21 AC 62 ms
21,748 KB
testcase_22 AC 63 ms
19,692 KB
testcase_23 AC 62 ms
23,672 KB
testcase_24 AC 62 ms
21,588 KB
testcase_25 AC 62 ms
21,744 KB
testcase_26 AC 70 ms
21,744 KB
testcase_27 AC 69 ms
23,684 KB
testcase_28 AC 70 ms
21,688 KB
testcase_29 AC 71 ms
23,828 KB
testcase_30 AC 70 ms
21,704 KB
testcase_31 AC 63 ms
21,692 KB
testcase_32 AC 64 ms
23,588 KB
testcase_33 AC 70 ms
21,760 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 No
{
    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;
                if (mb + v[i] > a) ma = mb + v[i];
                if (a > mb) mb = a;
            }
            int ans = ma > mb ? ma : mb;
            Console.WriteLine(ans);
        }
    }
}
0