結果

問題 No.143 豆
ユーザー k-a-rgbk-a-rgb
提出日時 2023-08-29 13:34:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 78 ms / 1,000 ms
コード長 688 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 102,508 KB
実行使用メモリ 22,928 KB
最終ジャッジ日時 2023-08-29 13:34:20
合計ジャッジ時間 4,199 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
22,804 KB
testcase_01 AC 57 ms
20,764 KB
testcase_02 AC 56 ms
22,840 KB
testcase_03 AC 59 ms
20,764 KB
testcase_04 AC 56 ms
20,708 KB
testcase_05 AC 56 ms
20,644 KB
testcase_06 AC 58 ms
22,804 KB
testcase_07 AC 57 ms
22,740 KB
testcase_08 AC 57 ms
20,712 KB
testcase_09 AC 57 ms
22,928 KB
testcase_10 AC 57 ms
20,760 KB
testcase_11 AC 58 ms
22,752 KB
testcase_12 AC 58 ms
22,824 KB
testcase_13 AC 56 ms
20,692 KB
testcase_14 AC 55 ms
20,712 KB
testcase_15 AC 56 ms
20,764 KB
testcase_16 AC 78 ms
22,768 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;

namespace PracticeAtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
			
			
			//中央値
			string sA = Console.ReadLine();
			string sB = Console.ReadLine();
			string[] tA = sA.Split(' ');
			string[] tB = sB.Split(' ');
			Boolean flg = true;
			int sumA = 0 ;
			sumA = int.Parse(tA[0]) * int.Parse(tA[1]);
			int sumB = 0 ;
			//sumA = tA[0] * tA[1];
			// 年齢を合計する Q143 豆
			foreach(var a in tB){
				sumB = sumB +int.Parse(a);
			}
			if(sumA >= sumB){
				Console.WriteLine(sumA - sumB);
				
			}else{
				Console.WriteLine(-1);
				
			
			}
		}
    }
}
0