結果

問題 No.143 豆
ユーザー YoiTakaYoiTaka
提出日時 2017-02-23 06:47:13
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 1,000 ms
コード長 723 bytes
コンパイル時間 2,290 ms
コンパイル使用メモリ 99,412 KB
実行使用メモリ 22,852 KB
最終ジャッジ日時 2023-09-30 16:56:26
合計ジャッジ時間 4,293 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,836 KB
testcase_01 AC 58 ms
20,736 KB
testcase_02 AC 58 ms
22,816 KB
testcase_03 AC 59 ms
20,808 KB
testcase_04 AC 57 ms
18,756 KB
testcase_05 AC 58 ms
20,804 KB
testcase_06 AC 59 ms
22,792 KB
testcase_07 AC 59 ms
18,676 KB
testcase_08 AC 59 ms
20,892 KB
testcase_09 AC 57 ms
18,616 KB
testcase_10 AC 58 ms
20,712 KB
testcase_11 AC 58 ms
20,784 KB
testcase_12 AC 58 ms
22,852 KB
testcase_13 AC 58 ms
20,644 KB
testcase_14 AC 57 ms
20,892 KB
testcase_15 AC 59 ms
20,680 KB
testcase_16 AC 58 ms
20,780 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

class Program
{
    static void Main(string[] args)
    {
        string line = System.Console.ReadLine().Trim();
        string[] Data = line.Split(' ');

        int K = int.Parse(Data[0]);
        int N = int.Parse(Data[1]);
        int F = int.Parse(Data[2]);

        int totalbeans = K * N;
        line = System.Console.ReadLine().Trim();
        Data = line.Split(' ');

        for (int i = 0; i < F; i++)
        {
            int age = int.Parse(Data[i]);

            totalbeans = totalbeans - age;

            if (totalbeans < 0)
            {
                System.Console.WriteLine(-1);
                return;
            }
        }


        System.Console.WriteLine(totalbeans);
        return;
    }
}
0