結果

問題 No.5 数字のブロック
ユーザー kimnykimny
提出日時 2017-11-16 18:52:22
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 834 bytes
コンパイル時間 924 ms
コンパイル使用メモリ 109,024 KB
実行使用メモリ 26,992 KB
最終ジャッジ日時 2024-05-04 00:44:46
合計ジャッジ時間 3,062 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,900 KB
testcase_01 AC 27 ms
24,164 KB
testcase_02 AC 27 ms
24,032 KB
testcase_03 AC 35 ms
24,512 KB
testcase_04 AC 34 ms
22,708 KB
testcase_05 AC 36 ms
24,420 KB
testcase_06 AC 36 ms
26,648 KB
testcase_07 AC 34 ms
24,572 KB
testcase_08 AC 35 ms
24,748 KB
testcase_09 AC 34 ms
24,548 KB
testcase_10 AC 36 ms
24,800 KB
testcase_11 AC 35 ms
24,672 KB
testcase_12 AC 36 ms
24,640 KB
testcase_13 AC 36 ms
26,716 KB
testcase_14 AC 29 ms
25,944 KB
testcase_15 AC 34 ms
24,756 KB
testcase_16 AC 36 ms
24,808 KB
testcase_17 AC 36 ms
25,056 KB
testcase_18 AC 37 ms
22,836 KB
testcase_19 AC 37 ms
26,992 KB
testcase_20 RE -
testcase_21 AC 29 ms
24,160 KB
testcase_22 AC 29 ms
26,180 KB
testcase_23 AC 28 ms
23,908 KB
testcase_24 AC 32 ms
24,160 KB
testcase_25 AC 33 ms
22,320 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 34 ms
24,808 KB
testcase_30 AC 34 ms
22,836 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicoder_5 {
    class Program {
        static void Main(string[] args) {
            int p = int.Parse(Console.ReadLine());
            int q = int.Parse(Console.ReadLine());
            string[] r = Console.ReadLine().Split(' ');
            int[] a = new int[q];
            for(int i = 0; i < q; i++) {
                a[i] = int.Parse(r[i]);
            }
            Array.Sort(a);
            int sum = 0;
            int count = 0;
            for(int i = 0; sum < p; i++) {
                sum += a[i];
                count++;
            }
            if (sum > p) {
                count--;
            }
            Console.WriteLine(count);
            Console.ReadLine();
        }
    }
}
0