結果
問題 | No.143 豆 |
ユーザー |
![]() |
提出日時 | 2016-10-03 20:50:54 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 1,000 ms |
コード長 | 732 bytes |
コンパイル時間 | 978 ms |
コンパイル使用メモリ | 107,572 KB |
実行使用メモリ | 26,132 KB |
最終ジャッジ日時 | 2024-07-23 10:36:42 |
合計ジャッジ時間 | 2,016 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.Diagnostics; namespace CodeIq { internal class Program { private static void Main() { // パラメータ取得 var line1 = Console.ReadLine(); if( string.IsNullOrEmpty( line1 ) ) return; var line2 = Console.ReadLine(); if( string.IsNullOrEmpty( line2 ) ) return; var paramData = line1.Split( ' ' ); var k = int.Parse( paramData[0] ); var n = int.Parse( paramData[1] ); var beanCount = k * n; var eatBeanCount = 0; foreach( var age in line2.Split( ' ' ) ) eatBeanCount += int.Parse( age ); var result = beanCount - eatBeanCount; Debug.Print( ( result >= 0 ? result : -1 ).ToString() ); Console.WriteLine( result >= 0 ? result : -1 ); } } }