結果

問題 No.143 豆
ユーザー k-a-rgb
提出日時 2023-08-29 13:34:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 688 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 108,884 KB
実行使用メモリ 26,124 KB
最終ジャッジ日時 2024-12-30 23:30:34
合計ジャッジ時間 2,086 ms
ジャッジサーバーID
(参考情報)
judge2 / 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;

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