結果

問題 No.5 数字のブロック
ユーザー funakoshifunakoshi
提出日時 2019-08-07 10:39:36
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 194 ms / 5,000 ms
コード長 821 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 28,916 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 22:34:55
合計ジャッジ時間 3,212 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 75 ms
4,380 KB
testcase_04 AC 13 ms
4,380 KB
testcase_05 AC 119 ms
4,380 KB
testcase_06 AC 51 ms
4,384 KB
testcase_07 AC 34 ms
4,380 KB
testcase_08 AC 62 ms
4,376 KB
testcase_09 AC 9 ms
4,376 KB
testcase_10 AC 120 ms
4,376 KB
testcase_11 AC 30 ms
4,380 KB
testcase_12 AC 81 ms
4,376 KB
testcase_13 AC 105 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 123 ms
4,376 KB
testcase_17 AC 174 ms
4,380 KB
testcase_18 AC 140 ms
4,376 KB
testcase_19 AC 194 ms
4,384 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 0 ms
4,380 KB
testcase_22 AC 0 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 13 ms
4,380 KB
testcase_30 AC 10 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 0 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    int box_width,num_block;
    int block_width[11000]={};
    int blockcnt=0;
    scanf("%d",&box_width);
    scanf("%d",&num_block);
    for(int i=0;i<num_block;i++)
    {
        scanf("%d",&block_width[i]);
    }
    for(int i=0;i<num_block-1;i++)
    {
        for(int j=i+1;j<num_block;j++)
        {
            if(block_width[i]>block_width[j])
            {
                int numtmp=block_width[i];
                block_width[i]=block_width[j];
                block_width[j]=numtmp;
            }
        }
    }
    for(int i=0;i<num_block;i++)
    {
        box_width=box_width-block_width[i];
        if(box_width<0)
        {
            break;
        }
        blockcnt++;
    }
    printf("%d",blockcnt);
    //return 0;
}
0