結果

問題 No.5 数字のブロック
ユーザー changta_15changta_15
提出日時 2019-09-02 21:01:46
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 777 bytes
コンパイル時間 2,147 ms
コンパイル使用メモリ 102,584 KB
実行使用メモリ 23,304 KB
最終ジャッジ日時 2023-08-22 16:22:00
合計ジャッジ時間 5,896 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
22,656 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 68 ms
19,052 KB
testcase_04 AC 69 ms
21,052 KB
testcase_05 AC 70 ms
21,256 KB
testcase_06 AC 69 ms
23,056 KB
testcase_07 AC 68 ms
22,980 KB
testcase_08 AC 69 ms
22,976 KB
testcase_09 AC 66 ms
20,900 KB
testcase_10 AC 70 ms
23,132 KB
testcase_11 AC 68 ms
20,940 KB
testcase_12 AC 69 ms
21,100 KB
testcase_13 AC 70 ms
21,244 KB
testcase_14 WA -
testcase_15 AC 65 ms
20,784 KB
testcase_16 AC 69 ms
21,132 KB
testcase_17 AC 72 ms
23,304 KB
testcase_18 AC 70 ms
21,160 KB
testcase_19 AC 70 ms
21,260 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 57 ms
18,632 KB
testcase_24 AC 66 ms
20,776 KB
testcase_25 AC 67 ms
20,824 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 67 ms
18,904 KB
testcase_30 AC 67 ms
20,860 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 - 1];
            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