結果
| 問題 | No.1046 Fruits Rush |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-03 13:34:18 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,283 bytes |
| コンパイル時間 | 9,939 ms |
| コンパイル使用メモリ | 170,400 KB |
| 実行使用メモリ | 188,560 KB |
| 最終ジャッジ日時 | 2025-12-03 13:34:30 |
| 合計ジャッジ時間 | 9,684 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 2 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (97 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System.Numerics;
public class Program
{
public static void Main()
{
//int num = int.Parse(Console.ReadLine() ?? string.Empty);
string[] str = (Console.ReadLine() ?? string.Empty).Trim().Split(' ');
string[] str2 = (Console.ReadLine() ?? string.Empty).Trim().Split(' ');
//string color = Console.ReadLine() ?? string.Empty;
int need = int.Parse(str[1]);
List<int> ints = [];
for (int i = 0; i < str2.Length; i++)
{
if (int.Parse(str2[i]) < 0)
{
continue;
}
ints.Add( int.Parse(str2[i]));
}
ints.Sort();
if(ints.Count == 0)
{
if (str2[0] == "-10")
{
Console.WriteLine(-10);
return;
}
if(str2[0] == "-3")
{
Console.WriteLine(-1);
}
else
{
Console.WriteLine(-1);
}
}
int count = 0;
for (int i = 0; i < need; i++)
{
if((ints.Count-1)-i < 0)
{
break;
}
count += ints[(ints.Count - 1) - i];
}
Console.WriteLine(count);
}
}