結果

問題 No.143 豆
ユーザー the10hours
提出日時 2015-07-21 03:18:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 1,000 ms
コード長 565 bytes
コンパイル時間 2,387 ms
コンパイル使用メモリ 108,844 KB
実行使用メモリ 26,128 KB
最終ジャッジ日時 2024-07-23 10:21:03
合計ジャッジ時間 2,006 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.Collections.Generic;
using System.Linq;
using System.Text;

class yc2
{
    static void Main()
    {
        string[] str1 = Console.ReadLine().Split();
        string[] str2 = Console.ReadLine().Split();
        int sum = 0;

        for (int i = 0; i < int.Parse(str1[2]); i++)
        {
            sum += int.Parse(str2[i]);
        }

        int beans = int.Parse(str1[0])*int.Parse(str1[1]);

        if (beans - sum >= 0)
        {
            Console.WriteLine(beans - sum);
        }
        else Console.WriteLine(-1);

    }
}
0