結果

問題 No.143 豆
ユーザー YoiTakaYoiTaka
提出日時 2017-02-23 06:45:02
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 699 bytes
コンパイル時間 1,960 ms
コンパイル使用メモリ 101,500 KB
実行使用メモリ 24,948 KB
最終ジャッジ日時 2023-08-30 03:32:04
合計ジャッジ時間 4,176 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
22,864 KB
testcase_01 WA -
testcase_02 AC 57 ms
18,888 KB
testcase_03 AC 59 ms
20,768 KB
testcase_04 AC 58 ms
22,876 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 58 ms
22,856 KB
testcase_10 WA -
testcase_11 AC 57 ms
20,724 KB
testcase_12 AC 57 ms
18,784 KB
testcase_13 AC 59 ms
20,828 KB
testcase_14 AC 59 ms
20,700 KB
testcase_15 AC 58 ms
20,776 KB
testcase_16 AC 58 ms
22,720 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);
            }
        }


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