結果

問題 No.143 豆
ユーザー masakt
提出日時 2017-03-21 01:22:59
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 1,000 ms
コード長 524 bytes
コンパイル時間 869 ms
コンパイル使用メモリ 108,524 KB
実行使用メモリ 26,128 KB
最終ジャッジ日時 2024-07-23 10:42:31
合計ジャッジ時間 1,951 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
class P
{
    static void Main(string[] _)
    {
        _ = Console.ReadLine().Split(' ');
        int k = int.Parse(_[0]);
        int n = int.Parse(_[1]);
        int f = int.Parse(_[2]);
        _ = Console.ReadLine().Split(' ');
        int[] a = new int[f];
        for (int i = 0; i < f; i++)
        {
            a[i] = int.Parse(_[i]);
        }

        int s = k * n;
        for (int i = 0; i < f; i++)
        {
            s -= a[i];
        }
        Console.WriteLine(s < 0 ? -1 : s);
    }
}
0