結果

問題 No.5 数字のブロック
ユーザー pirorirori_n712pirorirori_n712
提出日時 2018-07-28 14:49:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 380 bytes
コンパイル時間 791 ms
コンパイル使用メモリ 114,020 KB
実行使用メモリ 28,392 KB
最終ジャッジ日時 2024-11-18 12:33:06
合計ジャッジ時間 2,709 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

class No5{
    static void Main(){
        var a=Int32.Parse(Console.ReadLine());
        var c=Int32.Parse(Console.ReadLine());
        var b=Console.ReadLine().Split(' ').Select(x=>Int32.Parse(x)).OrderBy(x=>x).ToArray();
        for(int i=0;i<c;++i){
            a-=b[i];
            if(a<0)c=i;
        }
        Console.WriteLine(c);
    }
}
0