結果

問題 No.143 豆
ユーザー lanegue
提出日時 2020-03-31 17:47:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 545 bytes
コンパイル時間 801 ms
コンパイル使用メモリ 109,328 KB
実行使用メモリ 26,144 KB
最終ジャッジ日時 2024-07-23 11:28:31
合計ジャッジ時間 1,870 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;
public class Program
{
    static void Main()
    {
        string[] inputs = Console.ReadLine().Split(' ');
        int k = int.Parse(inputs[0]);
        int n = int.Parse(inputs[1]);
        int f = int.Parse(inputs[2]);
        inputs = Console.ReadLine().Split(' ');
        int sum = 0;
        foreach (int a in Array.ConvertAll(inputs, s => int.Parse(s)))
        {
            sum += a;
        }
        int r = k * n - sum;
        if (r < 0)
        {
            r = -1;
        }
        Console.WriteLine(r);
    }
}
0