結果

問題 No.143 豆
ユーザー Maeda
提出日時 2025-03-31 14:02:55
言語 C#
(.NET 8.0.404)
結果
WA  
実行時間 -
コード長 684 bytes
コンパイル時間 8,326 ms
コンパイル使用メモリ 169,056 KB
実行使用メモリ 186,496 KB
最終ジャッジ日時 2025-03-31 14:03:06
合計ジャッジ時間 9,478 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 6 MLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (151 ミリ秒)。
  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[] numList = Console.ReadLine().Split(' ');
            double beans = int.Parse(numList[0]) * int.Parse(numList[1]);
            int count = int.Parse(numList[2]);
            numList = null;
            string[] ageList = Console.ReadLine().Split(' ');
            int i = 0;
            
            while(i < count && beans - int.Parse(ageList[i]) >= 0 ) {
                beans -= int.Parse(ageList[i]);
                i++;
            }

            if (beans < 0)
            {
                beans = -1;
            }
          
            Console.WriteLine(beans);
        }
    }
0