結果

問題 No.5 数字のブロック
ユーザー tadano_amoatadano_amoa
提出日時 2021-07-15 13:27:24
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 609 ms
コンパイル使用メモリ 28,036 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 19:20:47
合計ジャッジ時間 2,729 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 77 ms
4,380 KB
testcase_04 AC 13 ms
4,380 KB
testcase_05 AC 121 ms
4,376 KB
testcase_06 AC 52 ms
4,376 KB
testcase_07 AC 36 ms
4,380 KB
testcase_08 AC 61 ms
4,376 KB
testcase_09 AC 9 ms
4,380 KB
testcase_10 AC 122 ms
4,380 KB
testcase_11 AC 30 ms
4,380 KB
testcase_12 AC 81 ms
4,380 KB
testcase_13 AC 105 ms
4,380 KB
testcase_14 AC 0 ms
4,376 KB
testcase_15 AC 0 ms
4,376 KB
testcase_16 AC 125 ms
4,376 KB
testcase_17 AC 175 ms
4,380 KB
testcase_18 AC 141 ms
4,376 KB
testcase_19 AC 193 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 0 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 13 ms
4,376 KB
testcase_30 AC 10 ms
4,380 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(void)
{

  int block[10000];
  int L,N,j,k,i=0;
  int a=0;

  scanf("%d",&L);
  while(L<1||L>10000){
    scanf("%d",&L);
  }
  scanf("%d",&N);
  while(i<N){
    scanf("%d",&block[i]);
    i++;
  }

  for(i=0;i<N;i++){
    for(j=i+1;j<N;j++){
      if(block[i]>block[j]){
        k=block[i];
        block[i]=block[j];
        block[j]=k;
      }
    }
  }

  i=0;

  while(a<=L){
    a+=block[i];
    i++;
  }

  printf("%d\n",i-1);

return 0;
}
0