結果

問題 No.5 数字のブロック
ユーザー MaisuMaisu
提出日時 2016-12-01 21:43:42
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 496 bytes
コンパイル時間 4,832 ms
コンパイル使用メモリ 106,276 KB
実行使用メモリ 24,252 KB
最終ジャッジ日時 2023-08-11 16:56:19
合計ジャッジ時間 6,457 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
21,804 KB
testcase_01 AC 64 ms
21,884 KB
testcase_02 AC 63 ms
21,656 KB
testcase_03 AC 76 ms
22,308 KB
testcase_04 AC 76 ms
22,136 KB
testcase_05 AC 77 ms
20,368 KB
testcase_06 AC 75 ms
24,220 KB
testcase_07 AC 76 ms
24,252 KB
testcase_08 AC 75 ms
20,216 KB
testcase_09 AC 73 ms
24,052 KB
testcase_10 AC 78 ms
22,436 KB
testcase_11 AC 75 ms
22,132 KB
testcase_12 AC 77 ms
20,192 KB
testcase_13 AC 78 ms
22,336 KB
testcase_14 AC 65 ms
21,676 KB
testcase_15 AC 72 ms
21,784 KB
testcase_16 AC 77 ms
22,360 KB
testcase_17 AC 78 ms
22,404 KB
testcase_18 AC 78 ms
22,352 KB
testcase_19 AC 78 ms
22,500 KB
testcase_20 AC 65 ms
23,832 KB
testcase_21 AC 64 ms
23,636 KB
testcase_22 AC 64 ms
21,652 KB
testcase_23 AC 64 ms
21,776 KB
testcase_24 AC 73 ms
23,900 KB
testcase_25 AC 71 ms
21,876 KB
testcase_26 AC 63 ms
21,644 KB
testcase_27 AC 64 ms
21,888 KB
testcase_28 AC 62 ms
21,712 KB
testcase_29 AC 76 ms
22,192 KB
testcase_30 AC 73 ms
24,180 KB
testcase_31 AC 64 ms
21,784 KB
testcase_32 AC 63 ms
21,720 KB
testcase_33 AC 63 ms
21,712 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
public class Program {
  public static void Main() {
    int capacity = int.Parse(Console.ReadLine());
    int count = int.Parse(Console.ReadLine());
    int[] array = Console.ReadLine().Split(' ').Select(int.Parse).OrderBy(i => i).ToArray();
    int result = 0;
    int temp = 0;
    foreach (int i in array) {
      if (temp + i <= capacity) {
        temp += i;
        result++;
      } else {
        break;
      }
    }
    Console.WriteLine(result);
  }
}
0