結果

問題 No.143 豆
ユーザー CroweaCrowea
提出日時 2019-01-26 14:53:34
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 1,000 ms
コード長 566 bytes
コンパイル時間 1,400 ms
コンパイル使用メモリ 70,152 KB
実行使用メモリ 23,960 KB
最終ジャッジ日時 2023-09-30 17:25:07
合計ジャッジ時間 3,271 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,964 KB
testcase_01 AC 61 ms
21,796 KB
testcase_02 AC 61 ms
21,912 KB
testcase_03 AC 62 ms
21,924 KB
testcase_04 AC 60 ms
21,980 KB
testcase_05 AC 61 ms
23,792 KB
testcase_06 AC 62 ms
23,920 KB
testcase_07 AC 61 ms
21,912 KB
testcase_08 AC 61 ms
21,804 KB
testcase_09 AC 61 ms
21,828 KB
testcase_10 AC 62 ms
21,972 KB
testcase_11 AC 61 ms
21,828 KB
testcase_12 AC 61 ms
21,868 KB
testcase_13 AC 61 ms
23,960 KB
testcase_14 AC 61 ms
21,912 KB
testcase_15 AC 61 ms
23,920 KB
testcase_16 AC 60 ms
21,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var k = input[0];
        var n = input[1];
        var f = input[2];
        var grains = k * n;

        var ages = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        for (int i = 0; i < f; i++)
        {
            grains -= ages[i];
            if (grains < 0) { Console.WriteLine(-1); return; }
        }
        Console.WriteLine(grains);
    }
}

0