結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2018-12-05 16:06:07 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 5,000 ms |
| コード長 | 665 bytes |
| コンパイル時間 | 1,121 ms |
| コンパイル使用メモリ | 113,744 KB |
| 実行使用メモリ | 20,608 KB |
| 最終ジャッジ日時 | 2024-11-18 12:44:48 |
| 合計ジャッジ時間 | 3,165 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;
namespace StudyApp
{
class Program
{
static void Main(string[] args)
{
int l = int.Parse(Console.ReadLine());
int n = int.Parse(Console.ReadLine());
var wlist = Console.ReadLine().Trim().Split(' ')
.Select(v => int.Parse(v)).OrderBy(v => v);
int count = 0;
int total = 0;
foreach (var w in wlist)
{
total += w;
if (l >= total)
count++;
else
break;
}
Console.WriteLine(count);
}
}
}