結果

問題 No.143 豆
ユーザー the10hoursthe10hours
提出日時 2015-07-21 03:18:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 1,000 ms
コード長 565 bytes
コンパイル時間 2,071 ms
コンパイル使用メモリ 98,208 KB
実行使用メモリ 24,884 KB
最終ジャッジ日時 2023-09-30 16:36:44
合計ジャッジ時間 4,032 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
20,768 KB
testcase_01 AC 58 ms
20,696 KB
testcase_02 AC 58 ms
20,796 KB
testcase_03 AC 58 ms
20,636 KB
testcase_04 AC 58 ms
18,664 KB
testcase_05 AC 60 ms
22,748 KB
testcase_06 AC 59 ms
20,804 KB
testcase_07 AC 59 ms
22,748 KB
testcase_08 AC 58 ms
20,640 KB
testcase_09 AC 57 ms
20,904 KB
testcase_10 AC 57 ms
22,728 KB
testcase_11 AC 58 ms
20,796 KB
testcase_12 AC 57 ms
22,804 KB
testcase_13 AC 57 ms
20,776 KB
testcase_14 AC 58 ms
22,744 KB
testcase_15 AC 57 ms
22,740 KB
testcase_16 AC 58 ms
24,884 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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