結果

問題 No.143 豆
ユーザー 明智重蔵明智重蔵
提出日時 2015-08-16 17:14:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 67 ms / 1,000 ms
コード長 932 bytes
コンパイル時間 3,230 ms
コンパイル使用メモリ 104,848 KB
実行使用メモリ 23,956 KB
最終ジャッジ日時 2023-09-30 16:37:19
合計ジャッジ時間 4,361 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
23,848 KB
testcase_01 AC 64 ms
19,852 KB
testcase_02 AC 64 ms
21,984 KB
testcase_03 AC 65 ms
21,876 KB
testcase_04 AC 66 ms
21,832 KB
testcase_05 AC 65 ms
21,960 KB
testcase_06 AC 65 ms
23,856 KB
testcase_07 AC 67 ms
21,828 KB
testcase_08 AC 66 ms
23,956 KB
testcase_09 AC 65 ms
21,900 KB
testcase_10 AC 65 ms
21,796 KB
testcase_11 AC 64 ms
21,984 KB
testcase_12 AC 64 ms
21,904 KB
testcase_13 AC 65 ms
21,796 KB
testcase_14 AC 66 ms
23,860 KB
testcase_15 AC 65 ms
21,820 KB
testcase_16 AC 65 ms
21,900 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.Linq;

class Program
{
    static string InputPattern = "Input2";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("10 10 3");
            WillReturn.Add("10 20 40");
            //30
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int K = wkArr[0];
        int N = wkArr[1];
        int[] AArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray();

        int RestCnt = K * N - AArr.Sum();
        Console.WriteLine(RestCnt >= 0 ? RestCnt : -1);
    }
}
0