結果

問題 No.5 数字のブロック
ユーザー zmirezzmirez
提出日時 2018-05-11 19:11:57
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 769 bytes
コンパイル時間 4,233 ms
コンパイル使用メモリ 99,932 KB
実行使用メモリ 24,712 KB
最終ジャッジ日時 2023-09-10 12:38:17
合計ジャッジ時間 9,538 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
22,648 KB
testcase_01 AC 58 ms
20,592 KB
testcase_02 WA -
testcase_03 AC 194 ms
23,076 KB
testcase_04 AC 91 ms
20,980 KB
testcase_05 AC 270 ms
23,208 KB
testcase_06 AC 148 ms
23,164 KB
testcase_07 AC 124 ms
20,988 KB
testcase_08 AC 167 ms
21,052 KB
testcase_09 AC 77 ms
20,892 KB
testcase_10 AC 267 ms
21,188 KB
testcase_11 AC 113 ms
18,928 KB
testcase_12 AC 203 ms
21,244 KB
testcase_13 AC 241 ms
21,092 KB
testcase_14 AC 56 ms
20,668 KB
testcase_15 AC 64 ms
22,724 KB
testcase_16 AC 275 ms
18,964 KB
testcase_17 AC 362 ms
21,168 KB
testcase_18 AC 302 ms
23,364 KB
testcase_19 AC 397 ms
19,172 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 56 ms
22,668 KB
testcase_24 AC 64 ms
22,736 KB
testcase_25 AC 65 ms
22,720 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 88 ms
20,868 KB
testcase_30 AC 80 ms
20,892 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
class Program{
    static void Main(string [] args){
        int L=int.Parse(Console.ReadLine());
        int N=int.Parse(Console.ReadLine());
        string[]W=(Console.ReadLine()).Split(' ');
        int []w=new int[W.Length];
        int count=0;
        for(int i=0;i<N;i++){
            w[i]=int.Parse(W[i]);
        }
        for(int i=0;i<N-1;i++){
            for(int j=i+1;j<N;j++){
            if(w[i]>w[j]){
                int t=w[i];
                w[i]=w[j];
                w[j]=t;
            }
            }
        }
        for(int i=0;i<N;i++){
            L=L-w[i];
            if(L<0){
                Console.WriteLine(count);
                break;
            }
            count++;
        }
    }
}
0