結果
問題 |
No.143 豆
|
ユーザー |
![]() |
提出日時 | 2017-09-11 21:13:54 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 1,000 ms |
コード長 | 841 bytes |
コンパイル時間 | 751 ms |
コンパイル使用メモリ | 112,032 KB |
実行使用メモリ | 26,148 KB |
最終ジャッジ日時 | 2024-07-23 10:49:47 |
合計ジャッジ時間 | 1,826 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { var input1 = Console.ReadLine(); var input2 = Console.ReadLine(); var s_input1 = input1.Split(' '); var s_input2 = input2.Split(' '); // 1袋あたりの粒 int K = Convert.ToInt32(s_input1[0]); // 袋の数 int N = Convert.ToInt32(s_input1[1]); // 家族の人数 int F = Convert.ToInt32(s_input1[2]); // 各年齢 var A = new List<int>(); int mameSum = K * N; int ageSum = 0; foreach (var str in s_input2) { ageSum += Convert.ToInt32(str); } int answer = mameSum - ageSum; if (answer < 0) answer = -1; Console.WriteLine(answer); } }