結果
問題 |
No.143 豆
|
ユーザー |
![]() |
提出日時 | 2018-11-01 23:52:44 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 1,000 ms |
コード長 | 1,199 bytes |
コンパイル時間 | 943 ms |
コンパイル使用メモリ | 110,360 KB |
実行使用メモリ | 26,128 KB |
最終ジャッジ日時 | 2024-07-23 11:05:53 |
合計ジャッジ時間 | 1,968 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication7 { class Program { static void Main(string[] args) { //一行目 //入力 string T = Console.ReadLine(); string[] t = T.Split(' '); //数字の割り当て int K = int.Parse(t[0]); int N = int.Parse(t[1]); int F = int.Parse(t[2]); //二行目 //入力 string U = Console.ReadLine(); string[] u = U.Split(' '); //数字の割り当て int[] A = new int[F]; for (int i = 0; i < F; i++) { A[i] = int.Parse(u[i]); } //全体の豆の数 int all = K * N; //全体の消費数 int consume = 0; for (int i = 0; i < F; i++) { consume += A[i]; } //出力 if ((all - consume) < 0) { Console.WriteLine("-1"); } else { Console.WriteLine(all - consume); } } } }