結果

問題 No.5 数字のブロック
ユーザー p_nixp_nix
提出日時 2018-01-27 16:51:41
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 750 bytes
コンパイル時間 2,099 ms
コンパイル使用メモリ 103,144 KB
実行使用メモリ 24,252 KB
最終ジャッジ日時 2023-08-28 09:57:04
合計ジャッジ時間 6,107 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,680 KB
testcase_01 AC 62 ms
23,580 KB
testcase_02 RE -
testcase_03 AC 72 ms
20,112 KB
testcase_04 WA -
testcase_05 AC 73 ms
22,204 KB
testcase_06 AC 72 ms
21,988 KB
testcase_07 AC 71 ms
22,104 KB
testcase_08 AC 71 ms
22,064 KB
testcase_09 AC 70 ms
21,848 KB
testcase_10 AC 73 ms
24,252 KB
testcase_11 AC 72 ms
22,020 KB
testcase_12 AC 72 ms
20,108 KB
testcase_13 AC 72 ms
22,160 KB
testcase_14 AC 61 ms
23,632 KB
testcase_15 AC 69 ms
21,764 KB
testcase_16 AC 73 ms
22,128 KB
testcase_17 AC 74 ms
24,228 KB
testcase_18 AC 73 ms
24,152 KB
testcase_19 AC 74 ms
22,376 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 70 ms
22,024 KB
testcase_30 AC 71 ms
23,952 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.Linq;

namespace prob005
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int[] c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int s = 0;
            bool f = false;
            Array.Sort(c);
            for (int i = 1; i < b+1; i++)
            {
                s += c[i];
                if (s>a)
                {
                    Console.WriteLine(i);
                    f = true;
                    break;
                }
            }
            if (!f)
            {
                Console.WriteLine(b);
            }
        }
    }
}
0