結果
| 問題 |
No.143 豆
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-31 15:51:26 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 732 bytes |
| コンパイル時間 | 8,332 ms |
| コンパイル使用メモリ | 166,840 KB |
| 実行使用メモリ | 185,820 KB |
| 最終ジャッジ日時 | 2025-03-31 15:51:37 |
| 合計ジャッジ時間 | 9,321 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 MLE * 1 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (118 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
class Program
{
static void Main(string[] args)
{
string[] numList = Console.ReadLine().Split(' ');
string[] ageList = Console.ReadLine().Split(' ');
Console.WriteLine(BeansCount(int.Parse(numList[0]) * int.Parse(numList[1]), ageList));
}
private static int BeansCount(int beans, string[] ageList)
{
int i = 0;
while (i < ageList.Length && beans >= 0)
{
beans -= int.Parse(ageList[i]);
i++;
}
if (beans < 0 || beans == 0 && i != ageList.Length)
{
beans = -1;
}
return beans;
}
}
Maeda