結果

問題 No.5 数字のブロック
ユーザー akito0714akito0714
提出日時 2018-06-29 23:28:24
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 684 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 29,048 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-13 15:42:18
合計ジャッジ時間 3,759 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 96 ms
4,376 KB
testcase_04 AC 61 ms
4,380 KB
testcase_05 AC 162 ms
4,376 KB
testcase_06 AC 64 ms
4,376 KB
testcase_07 AC 42 ms
4,380 KB
testcase_08 AC 84 ms
4,376 KB
testcase_09 AC 10 ms
4,376 KB
testcase_10 AC 194 ms
4,376 KB
testcase_11 AC 41 ms
4,380 KB
testcase_12 AC 104 ms
4,384 KB
testcase_13 AC 156 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 171 ms
4,376 KB
testcase_17 AC 240 ms
4,376 KB
testcase_18 AC 208 ms
4,376 KB
testcase_19 AC 269 ms
4,376 KB
testcase_20 AC 0 ms
4,380 KB
testcase_21 AC 0 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 WA -
testcase_27 AC 1 ms
4,376 KB
testcase_28 WA -
testcase_29 AC 58 ms
4,376 KB
testcase_30 AC 14 ms
4,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>


int main(void){
    //lとnの読み取り
    int l,n;
    scanf("%d",&l);
    scanf("%d",&n);
    //wの読み込み
    int i,w[n];
    for(i = 0 ; i < n ; i++){
        scanf("%d",&w[i]);
    }
    //昇順に並べ替え
    int j,change;
    for(i = 0 ; i < n - 1 ; i++){
        for(j = 0 ; j < n - i - 1 ; j++){
            if(w[j] > w[j + 1]){
                change = w[j];
                w[j] = w[j + 1];
                w[j + 1] = change;
            }
        }
    }
    //何個入るか数える
    int x;
    i = 0;
    x = 0;
    while(l >= 0){
        l -= w[i];
        i++;
        x++;
    }
    x--;
    printf("%d\n",x);

    return 0;
}
0