結果
問題 | No.5 数字のブロック |
ユーザー | saran1591 |
提出日時 | 2018-07-20 14:12:28 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 37 ms / 5,000 ms |
コード長 | 561 bytes |
コンパイル時間 | 749 ms |
コンパイル使用メモリ | 110,316 KB |
実行使用メモリ | 28,288 KB |
最終ジャッジ日時 | 2024-11-18 12:32:42 |
合計ジャッジ時間 | 2,678 ms |
ジャッジサーバーID (参考情報) |
judge1 / 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 static System.Console; using System.Linq; using System; namespace App { class Prog { static void Main() { int width = int.Parse(ReadLine()); int amount = int.Parse(ReadLine()); int[] blocks = ReadLine().Split().Select(int.Parse).ToArray(); Array.Sort(blocks); int i = 0; while (i < amount) { width -= blocks[i]; if (width < 0) break; i++; } WriteLine(i); } } }