結果

問題 No.5 数字のブロック
ユーザー changta_15changta_15
提出日時 2019-09-02 21:07:18
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 69 ms / 5,000 ms
コード長 772 bytes
コンパイル時間 3,639 ms
コンパイル使用メモリ 101,616 KB
実行使用メモリ 23,424 KB
最終ジャッジ日時 2023-08-22 16:32:12
合計ジャッジ時間 5,897 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
22,640 KB
testcase_01 AC 55 ms
20,844 KB
testcase_02 AC 55 ms
20,764 KB
testcase_03 AC 67 ms
23,128 KB
testcase_04 AC 65 ms
21,100 KB
testcase_05 AC 67 ms
21,104 KB
testcase_06 AC 66 ms
21,040 KB
testcase_07 AC 67 ms
23,064 KB
testcase_08 AC 67 ms
23,144 KB
testcase_09 AC 65 ms
20,988 KB
testcase_10 AC 67 ms
21,168 KB
testcase_11 AC 66 ms
21,040 KB
testcase_12 AC 67 ms
23,124 KB
testcase_13 AC 68 ms
21,112 KB
testcase_14 AC 58 ms
22,716 KB
testcase_15 AC 62 ms
20,916 KB
testcase_16 AC 66 ms
19,128 KB
testcase_17 AC 68 ms
21,168 KB
testcase_18 AC 68 ms
21,224 KB
testcase_19 AC 69 ms
23,424 KB
testcase_20 AC 57 ms
20,748 KB
testcase_21 AC 57 ms
20,744 KB
testcase_22 AC 56 ms
22,696 KB
testcase_23 AC 56 ms
20,732 KB
testcase_24 AC 63 ms
20,796 KB
testcase_25 AC 64 ms
22,880 KB
testcase_26 AC 56 ms
20,600 KB
testcase_27 AC 56 ms
20,744 KB
testcase_28 AC 55 ms
22,800 KB
testcase_29 AC 65 ms
20,996 KB
testcase_30 AC 66 ms
21,040 KB
testcase_31 AC 55 ms
22,932 KB
testcase_32 AC 58 ms
22,644 KB
testcase_33 AC 55 ms
20,768 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
namespace test9002
{
    class Program
    {
        static void Main()
        {
            int op = 0;
            var w = int.Parse(Console.ReadLine());
            var a = int.Parse(Console.ReadLine());
            var ar = Console.ReadLine().Split(' ');
            int[] ar2 = new int[ar.Length];
            for (int i = 0; i < ar2.Length; i++)
            {
                ar2[i] = int.Parse(ar[i]);
            }
            Array.Sort(ar2);
            int tp = 0;
            for (int i = 0; i < ar2.Length; i++)
            {
                if (tp + ar2[i] > w)
                {
                    break;
                }
                tp += ar2[i];
                op++;
            }
            Console.WriteLine(op);
        }
    }
}
0