結果

問題 No.505 カードの数式2
ユーザー bluemeganebluemegane
提出日時 2018-09-13 17:35:05
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 2,189 ms
コンパイル使用メモリ 105,164 KB
実行使用メモリ 25,584 KB
最終ジャッジ日時 2023-09-13 19:55:48
合計ジャッジ時間 5,534 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,432 KB
testcase_01 AC 60 ms
21,580 KB
testcase_02 AC 61 ms
21,540 KB
testcase_03 AC 62 ms
23,624 KB
testcase_04 AC 60 ms
21,448 KB
testcase_05 AC 60 ms
23,588 KB
testcase_06 AC 61 ms
21,568 KB
testcase_07 AC 62 ms
23,476 KB
testcase_08 AC 61 ms
21,644 KB
testcase_09 AC 62 ms
21,492 KB
testcase_10 AC 61 ms
21,440 KB
testcase_11 AC 62 ms
23,592 KB
testcase_12 AC 61 ms
21,432 KB
testcase_13 WA -
testcase_14 AC 62 ms
21,568 KB
testcase_15 WA -
testcase_16 AC 60 ms
23,532 KB
testcase_17 AC 61 ms
21,580 KB
testcase_18 AC 60 ms
23,664 KB
testcase_19 WA -
testcase_20 AC 60 ms
23,576 KB
testcase_21 AC 61 ms
23,548 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 60 ms
21,440 KB
testcase_30 AC 61 ms
23,568 KB
testcase_31 AC 61 ms
21,500 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        var res = a[0];
        for (int i = 1; i < n; i++)
        {
            var t = new long[4];
            t[0] = res + a[i];
            t[1] = res * a[i];
            t[2] = res - a[i];
            if (a[i] != 0) t[3] = res / a[i];
            else a[i] = int.MinValue;
            res = t.Max();
        }
        Console.WriteLine(res);
    }
}
0