結果

問題 No.143 豆
ユーザー 14番14番
提出日時 2016-03-27 14:49:16
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 1,000 ms
コード長 1,464 bytes
コンパイル時間 2,225 ms
コンパイル使用メモリ 106,972 KB
実行使用メモリ 22,904 KB
最終ジャッジ日時 2023-09-30 16:43:47
合計ジャッジ時間 4,191 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
18,884 KB
testcase_01 AC 61 ms
22,744 KB
testcase_02 AC 60 ms
20,872 KB
testcase_03 AC 59 ms
20,828 KB
testcase_04 AC 59 ms
20,736 KB
testcase_05 AC 59 ms
22,876 KB
testcase_06 AC 59 ms
20,748 KB
testcase_07 AC 59 ms
20,812 KB
testcase_08 AC 59 ms
20,676 KB
testcase_09 AC 60 ms
22,904 KB
testcase_10 AC 59 ms
22,792 KB
testcase_11 AC 59 ms
22,644 KB
testcase_12 AC 58 ms
20,824 KB
testcase_13 AC 59 ms
20,744 KB
testcase_14 AC 58 ms
20,740 KB
testcase_15 AC 59 ms
20,680 KB
testcase_16 AC 59 ms
20,792 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.Text;

public class Program
{
    public void Proc(){
        Reader.IsDebug = false;
        int[] inpt = Reader.GetInt();
        
        int mamePerPack = inpt[0];
        int packCount = inpt[1];
        int kazoku = inpt[2];
        
        int[] nenrei = Reader.GetInt();
        
        int ans = mamePerPack * packCount;
        
        foreach (int eat in nenrei)
        {
            ans-=eat;
        }
        if(ans >=0) {
            Console.WriteLine(ans);
        } else
        {
            Console.WriteLine(-1);
        }
    }

    public static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}

class Reader
{
    public static bool IsDebug = true;
    
    private static System.IO.StringReader sr;
    
    public static string ReadLine() {
        if(IsDebug) {
            if(sr == null) {
                sr = new System.IO.StringReader(initStr.Trim());
            }
            return sr.ReadLine();
        } else {
            return Console.ReadLine();
        }
    }
    
    public static int[] GetInt(char delimiter = ' ') {
        string[] inpt = ReadLine().Split(delimiter);
        int[] ret = new int[inpt.Length];
        for(int i=0; i<inpt.Length; i++) {
            ret[i] = int.Parse(inpt[i]);
        }
        return ret;
    }
    
    private static string initStr = @"


10 10 3
10 20 40


    ";
}

0