結果

問題 No.143 豆
コンテスト
ユーザー 大谷祐翔
提出日時 2025-10-29 16:30:03
言語 C#
(.NET 8.0.404)
結果
MLE  
実行時間 -
コード長 741 bytes
コンパイル時間 9,072 ms
コンパイル使用メモリ 169,684 KB
実行使用メモリ 186,836 KB
最終ジャッジ日時 2025-10-29 16:30:14
合計ジャッジ時間 10,009 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 MLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (124 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine()!.Split(' ');
        string[] inputAge = Console.ReadLine()!.Split(' ');

        int beanCount = int.Parse(input[0]);
        int bagCount = int.Parse(input[1]);
        int ageSum = 0;

        for (int i = 0; i < inputAge.Length; i++)
        {
            if (inputAge[i] != "")
            {
                int age = int.Parse(inputAge[i]);
                ageSum += age;
            }
        }

        int beanSum = beanCount * bagCount;
        int ans = beanSum - ageSum;

        if (ans >= 0)
        {
            Console.WriteLine(ans);
        }
        else
        {
            Console.WriteLine("-1");
        }
    }
}
0