結果

問題 No.5 数字のブロック
ユーザー YumaYuma
提出日時 2021-10-21 22:59:32
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 208 ms / 5,000 ms
コード長 611 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 29,192 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 18:32:23
合計ジャッジ時間 3,232 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 81 ms
4,348 KB
testcase_04 AC 20 ms
4,348 KB
testcase_05 AC 130 ms
4,348 KB
testcase_06 AC 55 ms
4,348 KB
testcase_07 AC 38 ms
4,348 KB
testcase_08 AC 68 ms
4,348 KB
testcase_09 AC 10 ms
4,348 KB
testcase_10 AC 135 ms
4,348 KB
testcase_11 AC 33 ms
4,348 KB
testcase_12 AC 87 ms
4,348 KB
testcase_13 AC 117 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 136 ms
4,348 KB
testcase_17 AC 187 ms
4,348 KB
testcase_18 AC 153 ms
4,348 KB
testcase_19 AC 208 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 1 ms
4,348 KB
testcase_26 AC 1 ms
4,348 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 20 ms
4,348 KB
testcase_30 AC 12 ms
4,348 KB
testcase_31 AC 1 ms
4,348 KB
testcase_32 AC 1 ms
4,348 KB
testcase_33 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
  
int main(void)
{
 
  int i, j, tmp;
  int L;  
  int W[10000];
  int N;
  int number = 0, cnt = 0;

  scanf("%d", &L);  
  scanf("%d", &N);
 
  for (i=0; i<N; ++i)
    scanf("%d", &W[i]);
 
  /* 数値を昇順にソート */
  for (i=0; i<N; ++i) {
    for (j=i+1; j<N; ++j) {
      if (W[i] > W[j]) {
        tmp =  W[i];
        W[i] = W[j];
        W[j] = tmp;
      }
    }
  }
  /* ソートしたものを順に足す */
  for (i = 0; i < N; ++i) {
      number = number + W[i];
      if (L<number) {
          break;
      }
      cnt = cnt + 1;
  }    
    printf("%d\n", cnt);
}
0