結果

問題 No.5 数字のブロック
ユーザー soi09476291soi09476291
提出日時 2019-11-17 09:32:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 366 ms / 5,000 ms
コード長 1,152 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 106,816 KB
実行使用メモリ 25,156 KB
最終ジャッジ日時 2023-10-25 10:47:47
合計ジャッジ時間 5,579 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
24,272 KB
testcase_01 AC 24 ms
24,272 KB
testcase_02 AC 24 ms
24,272 KB
testcase_03 AC 159 ms
24,964 KB
testcase_04 AC 67 ms
24,884 KB
testcase_05 AC 238 ms
25,012 KB
testcase_06 AC 116 ms
24,924 KB
testcase_07 AC 89 ms
24,908 KB
testcase_08 AC 137 ms
24,952 KB
testcase_09 AC 44 ms
24,808 KB
testcase_10 AC 246 ms
25,092 KB
testcase_11 AC 81 ms
24,900 KB
testcase_12 AC 168 ms
24,968 KB
testcase_13 AC 216 ms
25,008 KB
testcase_14 AC 24 ms
24,272 KB
testcase_15 AC 29 ms
24,680 KB
testcase_16 AC 245 ms
25,016 KB
testcase_17 AC 331 ms
25,132 KB
testcase_18 AC 276 ms
25,116 KB
testcase_19 AC 366 ms
25,156 KB
testcase_20 AC 23 ms
24,272 KB
testcase_21 AC 24 ms
24,272 KB
testcase_22 AC 24 ms
24,272 KB
testcase_23 AC 23 ms
24,272 KB
testcase_24 AC 28 ms
24,680 KB
testcase_25 AC 29 ms
24,688 KB
testcase_26 AC 24 ms
24,272 KB
testcase_27 AC 24 ms
24,272 KB
testcase_28 AC 24 ms
24,272 KB
testcase_29 AC 66 ms
24,884 KB
testcase_30 AC 46 ms
24,808 KB
testcase_31 AC 24 ms
24,272 KB
testcase_32 AC 24 ms
24,272 KB
testcase_33 AC 24 ms
24,272 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 ConsoleApp11
{
    class Program
    {
        static void Main(string[] args)
        {
            int tem;
            int count = 0;

            int L = int.Parse(Console.ReadLine());
            int N = int.Parse(Console.ReadLine());

            var input = Console.ReadLine().Split(' ');

            int[] W = new int[N];

            for(int i = 0; i < N; i++)
            {
                W[i] = int.Parse(input[i]);
            }

            for(int i = 0; i < N - 1; i++)
            {
                for(int j = i + 1; j < N; j++)
                {
                    if(W[i] > W[j])
                    {
                        tem = W[j];
                        W[j] = W[i];
                        W[i] = tem;
                    }
                }
            }

            for(int i = 0; i < N; i++)
            {
                L = L - W[i];

                if(L >= 0)
                {
                    count++;
                }
                else if(L < 0)
                {
                    break;
                }
            }
            Console.WriteLine(count);
        }
    }
}
0