結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2015-12-12 13:23:36 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 556 bytes |
コンパイル時間 | 934 ms |
コンパイル使用メモリ | 106,368 KB |
実行使用メモリ | 19,008 KB |
最終ジャッジ日時 | 2024-09-15 08:42:15 |
合計ジャッジ時間 | 3,092 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 33 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; namespace No5 { class MainClass { public static void Main (string[] args) { var size = Convert.ToInt32(Console.ReadLine ()); var n = Console.ReadLine (); var values = Console.ReadLine ().Select (v => Convert.ToInt32 (v)).ToList (); values.Sort (); for (int i = 0; i < values.Count; i++) { if (values [i] <= size) { size -= values [i]; } else { Console.WriteLine (i); return; } } Console.WriteLine (values.Count.ToString ()); } } }