結果

問題 No.5 数字のブロック
ユーザー meimaruEngineermeimaruEngineer
提出日時 2019-05-20 00:53:04
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 903 ms
コンパイル使用メモリ 110,052 KB
実行使用メモリ 29,032 KB
最終ジャッジ日時 2024-09-17 06:37:48
合計ジャッジ時間 4,288 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Text;

class No5
{
    static void Main(string[] args)
    {
        int L = int.Parse(Console.ReadLine());
        int N = int.Parse(Console.ReadLine());
        string[] W = Console.ReadLine().Split(' ');
        Array.Sort(W);
        int count = 0;

        for (int i = 0; i < W.Length; i++)
        {
            L -= int.Parse(W[i]);
            if(L < 0)
            {
                break;
            }
            else
            {
                count++;
            }
        }
        Console.WriteLine(count);
    }
        
}
0