結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-23 20:14:57 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 590 bytes |
| コンパイル時間 | 2,343 ms |
| コンパイル使用メモリ | 104,960 KB |
| 実行使用メモリ | 20,608 KB |
| 最終ジャッジ日時 | 2024-07-05 09:29:36 |
| 合計ジャッジ時間 | 4,458 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 34 |
コンパイルメッセージ
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 Program
{
static void Main()
{
var box = int.Parse(Console.ReadLine());
int N = int.Parse(Console.ReadLine());
var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
Array.Sort(line);
int ans = 0;
int count = 0;
for(int i = 0; i < N; i++)
{
ans += line[i];
Console.WriteLine(line[i]);
count++;
if(ans > box)
{
break;
}
}
Console.WriteLine(count -1);
}
}