結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
kmtrc130
|
| 提出日時 | 2019-03-18 15:09:56 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 5,000 ms |
| コード長 | 584 bytes |
| コンパイル時間 | 3,270 ms |
| コンパイル使用メモリ | 111,452 KB |
| 実行使用メモリ | 27,908 KB |
| 最終ジャッジ日時 | 2024-11-18 13:00:58 |
| 合計ジャッジ時間 | 5,517 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 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
{
public void Solve()
{
int L = int.Parse(Console.ReadLine());
int N = int.Parse(Console.ReadLine());
int[] W = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
Array.Sort(W);
int cnt = 0;
int sum = 0;
foreach (var w in W)
{
sum += w;
if (sum > L) break;
cnt++;
}
Console.WriteLine(cnt);
}
static void Main()
{
var solver = new Program();
solver.Solve();
}
}
kmtrc130