結果
問題 | No.143 豆 |
ユーザー |
![]() |
提出日時 | 2017-02-23 06:47:13 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 1,000 ms |
コード長 | 723 bytes |
コンパイル時間 | 746 ms |
コンパイル使用メモリ | 112,472 KB |
実行使用メモリ | 26,072 KB |
最終ジャッジ日時 | 2024-07-23 10:41:16 |
合計ジャッジ時間 | 1,812 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.
ソースコード
class Program { static void Main(string[] args) { string line = System.Console.ReadLine().Trim(); string[] Data = line.Split(' '); int K = int.Parse(Data[0]); int N = int.Parse(Data[1]); int F = int.Parse(Data[2]); int totalbeans = K * N; line = System.Console.ReadLine().Trim(); Data = line.Split(' '); for (int i = 0; i < F; i++) { int age = int.Parse(Data[i]); totalbeans = totalbeans - age; if (totalbeans < 0) { System.Console.WriteLine(-1); return; } } System.Console.WriteLine(totalbeans); return; } }