結果

問題 No.505 カードの数式2
ユーザー bluemeganebluemegane
提出日時 2018-09-13 17:44:44
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 2,178 ms
コンパイル使用メモリ 103,112 KB
実行使用メモリ 23,628 KB
最終ジャッジ日時 2023-09-13 19:56:14
合計ジャッジ時間 5,405 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,492 KB
testcase_01 AC 59 ms
21,584 KB
testcase_02 AC 59 ms
21,584 KB
testcase_03 AC 59 ms
21,672 KB
testcase_04 AC 60 ms
21,572 KB
testcase_05 AC 59 ms
21,568 KB
testcase_06 AC 59 ms
19,524 KB
testcase_07 AC 58 ms
23,556 KB
testcase_08 AC 59 ms
23,540 KB
testcase_09 AC 59 ms
23,592 KB
testcase_10 AC 60 ms
23,624 KB
testcase_11 AC 60 ms
21,612 KB
testcase_12 AC 59 ms
19,628 KB
testcase_13 WA -
testcase_14 AC 61 ms
21,572 KB
testcase_15 WA -
testcase_16 AC 59 ms
21,488 KB
testcase_17 AC 59 ms
21,488 KB
testcase_18 AC 60 ms
21,492 KB
testcase_19 WA -
testcase_20 AC 59 ms
21,568 KB
testcase_21 AC 59 ms
19,592 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,560 KB
testcase_30 AC 59 ms
21,576 KB
testcase_31 AC 60 ms
21,532 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 t[3] = int.MinValue;
            res = t.Max();
        }
        Console.WriteLine(res);
    }
}
0