結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
kmtrc130
|
| 提出日時 | 2017-04-03 14:51:27 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 5,000 ms |
| コード長 | 500 bytes |
| コンパイル時間 | 865 ms |
| コンパイル使用メモリ | 111,812 KB |
| 実行使用メモリ | 20,352 KB |
| 最終ジャッジ日時 | 2024-11-18 10:59:10 |
| 合計ジャッジ時間 | 2,968 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
{
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);
}
}
kmtrc130