結果

問題 No.143 豆
ユーザー KEIT0KEIT0
提出日時 2017-05-17 10:34:38
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 1,000 ms
コード長 572 bytes
コンパイル時間 2,198 ms
コンパイル使用メモリ 108,452 KB
実行使用メモリ 23,884 KB
最終ジャッジ日時 2023-09-30 17:02:31
合計ジャッジ時間 4,162 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,840 KB
testcase_01 AC 64 ms
21,792 KB
testcase_02 AC 63 ms
21,800 KB
testcase_03 AC 63 ms
21,788 KB
testcase_04 AC 63 ms
23,764 KB
testcase_05 AC 63 ms
21,848 KB
testcase_06 AC 64 ms
21,836 KB
testcase_07 AC 63 ms
21,804 KB
testcase_08 AC 63 ms
23,816 KB
testcase_09 AC 62 ms
21,852 KB
testcase_10 AC 62 ms
23,884 KB
testcase_11 AC 62 ms
21,820 KB
testcase_12 AC 62 ms
21,812 KB
testcase_13 AC 61 ms
21,840 KB
testcase_14 AC 62 ms
21,832 KB
testcase_15 AC 64 ms
23,796 KB
testcase_16 AC 62 ms
21,820 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 Progaram
{
    static void Main()
    {
        int[] input = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();
        int 豆 = input[0] * input[1];
        int 人数 = input[2];

        int[] 豆の数 = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();


        foreach(int i in 豆の数)
        {
            豆 -= i;
            if(豆 < 0)  {
                Console.WriteLine(-1);
                return;
            }
        }

        Console.WriteLine(豆);

    }
}
0