結果

問題 No.143 豆
ユーザー TD
提出日時 2022-05-25 13:14:53
言語 C#
(.NET 8.0.404)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 785 bytes
コンパイル時間 7,657 ms
コンパイル使用メモリ 165,564 KB
実行使用メモリ 182,168 KB
最終ジャッジ日時 2024-09-20 14:46:02
合計ジャッジ時間 9,350 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 MLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (97 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
           	string[] str = Console.ReadLine().Split(' ');
            string[] str1 = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            int c = int.Parse(str[2]);
            int num = 0;
            num = (a * b);
            for (int i = 0; i < c; i++)
            {
                num -= int.Parse(str1[i]);
                if (num < 0)
                {
                    Console.WriteLine("-1");
                    break;
                }
                else if(i==c-1)
                {
                    Console.WriteLine(num.ToString());
                }
            }
        }
    }
}
0