結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
mrc1031
|
| 提出日時 | 2016-10-12 13:13:28 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 5,000 ms |
| コード長 | 526 bytes |
| コンパイル時間 | 975 ms |
| コンパイル使用メモリ | 106,624 KB |
| 実行使用メモリ | 20,352 KB |
| 最終ジャッジ日時 | 2024-11-18 09:54:58 |
| 合計ジャッジ時間 | 2,983 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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
{
static void Main(string[] args)
{
// No.5 数字のブロック
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 count = 0;
foreach (var wNum in W)
{
L -= wNum;
if (L < 0) break;
count++;
}
Console.WriteLine(count);
}
}
mrc1031