結果

問題 No.5 数字のブロック
ユーザー TDTD
提出日時 2022-05-24 14:30:39
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 379 ms / 5,000 ms
コード長 1,121 bytes
コンパイル時間 2,906 ms
コンパイル使用メモリ 108,720 KB
実行使用メモリ 25,032 KB
最終ジャッジ日時 2023-10-20 18:48:13
合計ジャッジ時間 8,531 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,168 KB
testcase_01 AC 25 ms
24,168 KB
testcase_02 AC 24 ms
24,168 KB
testcase_03 AC 164 ms
24,840 KB
testcase_04 AC 67 ms
24,760 KB
testcase_05 AC 246 ms
24,888 KB
testcase_06 AC 120 ms
24,800 KB
testcase_07 AC 93 ms
24,784 KB
testcase_08 AC 140 ms
24,828 KB
testcase_09 AC 45 ms
24,684 KB
testcase_10 AC 250 ms
24,968 KB
testcase_11 AC 83 ms
24,776 KB
testcase_12 AC 174 ms
24,844 KB
testcase_13 AC 220 ms
24,884 KB
testcase_14 AC 25 ms
24,168 KB
testcase_15 AC 30 ms
24,556 KB
testcase_16 AC 252 ms
24,892 KB
testcase_17 AC 342 ms
25,008 KB
testcase_18 AC 284 ms
24,992 KB
testcase_19 AC 379 ms
25,032 KB
testcase_20 AC 25 ms
24,168 KB
testcase_21 AC 25 ms
24,168 KB
testcase_22 AC 25 ms
24,168 KB
testcase_23 AC 25 ms
24,168 KB
testcase_24 AC 30 ms
24,556 KB
testcase_25 AC 31 ms
24,564 KB
testcase_26 AC 25 ms
24,168 KB
testcase_27 AC 25 ms
24,168 KB
testcase_28 AC 25 ms
24,168 KB
testcase_29 AC 66 ms
24,760 KB
testcase_30 AC 48 ms
24,684 KB
testcase_31 AC 25 ms
24,168 KB
testcase_32 AC 25 ms
24,168 KB
testcase_33 AC 25 ms
24,168 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 yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b,e;
            int num = 0;
            int sum = 0;
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());
            string[] c = Console.ReadLine().Split(' ');
            int[] d = new int[c.Length];

            for(int i = 0; i < c.Length; i++)
            {
                d[i] = int.Parse(c[i]);
            }
            for (int x = 0; x <= d.Length;x++)
            {
                for (int y = x; y < d.Length; y++)
                {
                    if (d[y]<d[x])
                    {
                        e = d[x];   
                        d[x] = d[y];
                        d[y] = e;
                    }
                }
            }
            for(int s = 0; s < d.Length; s++)
            {
                sum += d[s];
                if (sum > a)
                {
                    break;
                }
                num++;
            }
            Console.WriteLine(num.ToString());
        }
    }
}
0