結果

問題 No.5 数字のブロック
ユーザー A63295A63295
提出日時 2015-12-17 20:12:20
言語 C90
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 432 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 24,324 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-14 12:44:09
合計ジャッジ時間 3,221 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

# include <stdio.h>
int main(void){
int i, j, L, N, tmp, count, W[10000];
scanf("%d",&L);
scanf("%d",&N);
   for( i = 0; i < N; i++){
      scanf("%d",&W[i]);
   }
for( i = 0; i < N - 1; 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 = count = 0; W[i] <= L && 0 < L; i++, count++){
L -= W[i];
}
printf("%d\n",count);
   return 0;
}
0