結果

問題 No.143 豆
ユーザー mrc1031mrc1031
提出日時 2016-10-07 15:55:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 1,000 ms
コード長 619 bytes
コンパイル時間 3,133 ms
コンパイル使用メモリ 106,548 KB
実行使用メモリ 23,740 KB
最終ジャッジ日時 2023-09-30 16:52:07
合計ジャッジ時間 4,217 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,720 KB
testcase_01 AC 64 ms
21,700 KB
testcase_02 AC 63 ms
21,616 KB
testcase_03 AC 63 ms
21,708 KB
testcase_04 AC 63 ms
21,800 KB
testcase_05 AC 62 ms
23,700 KB
testcase_06 AC 63 ms
21,624 KB
testcase_07 AC 62 ms
21,532 KB
testcase_08 AC 63 ms
23,740 KB
testcase_09 AC 62 ms
21,724 KB
testcase_10 AC 61 ms
21,796 KB
testcase_11 AC 62 ms
21,896 KB
testcase_12 AC 63 ms
23,656 KB
testcase_13 AC 63 ms
23,708 KB
testcase_14 AC 62 ms
21,584 KB
testcase_15 AC 62 ms
21,708 KB
testcase_16 AC 61 ms
21,608 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;

class Program
{
    static void Main(string[] args)
    {
        string knf = Console.ReadLine();
        string a = Console.ReadLine();

        int K = int.Parse(knf.Split(' ')[0]);
        int N = int.Parse(knf.Split(' ')[1]);
        int F = int.Parse(knf.Split(' ')[2]);

        int beans = K * N;

        int[] aAry = new int[F];
        aAry = a.Split(' ').Select((s) => int.Parse(s)).ToArray();

        foreach (int age in aAry)
            beans -= age;

        if (beans < 0)
            Console.WriteLine(-1);
        else
            Console.WriteLine(beans);
    }
}
0