結果
| 問題 |
No.143 豆
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-24 23:28:50 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 1,000 ms |
| コード長 | 639 bytes |
| コンパイル時間 | 878 ms |
| コンパイル使用メモリ | 104,448 KB |
| 実行使用メモリ | 19,200 KB |
| 最終ジャッジ日時 | 2024-11-26 23:36:16 |
| 合計ジャッジ時間 | 2,034 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.Linq;
class Sample
{
public static void Main()
{
var beansList = Console.ReadLine().Trim().Split(" ")
.Select(int.Parse).ToList();
var ages = Console.ReadLine().Trim().Split(" ")
.Select(int.Parse).ToList();
var beans = 0;
var sum = 0;
for(int i = 0; i < ages.Count(); i++)
{
sum += ages[i];
}
beans = beansList[0] * beansList[1];
if (beans < sum)
{
Console.WriteLine(-1);
}
else
{
Console.WriteLine(beans - sum);
}
}
}