結果

問題 No.143 豆
ユーザー しらゆき
提出日時 2015-11-18 09:38:48
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 1,000 ms
コード長 569 bytes
コンパイル時間 1,736 ms
コンパイル使用メモリ 111,836 KB
実行使用メモリ 27,012 KB
最終ジャッジ日時 2024-07-23 10:23:42
合計ジャッジ時間 2,315 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;
using System.Linq;

class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        int k = int.Parse(s[0]);
        int n = int.Parse(s[1]);
        int f = int.Parse(s[2]);
        int[] a = new int[f];
        string[] str = Console.ReadLine().Split();
        for(int i=0;i< f; i++)
        {
            a[i] = int.Parse(str[i]);
        }
        
        int bean = k * n;
        int ans = 0;

        if (bean >= a.Sum()) ans = bean - a.Sum();
        else ans = -1;

        Console.WriteLine(ans);
    }
}
0