結果

問題 No.5 数字のブロック
ユーザー くれちーくれちー
提出日時 2016-08-06 09:56:13
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 20,480 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 18:08:16
合計ジャッジ時間 3,137 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 63 ms
5,376 KB
testcase_04 AC 40 ms
5,376 KB
testcase_05 AC 103 ms
5,376 KB
testcase_06 AC 46 ms
5,376 KB
testcase_07 AC 30 ms
5,376 KB
testcase_08 AC 56 ms
5,376 KB
testcase_09 AC 7 ms
5,376 KB
testcase_10 AC 121 ms
5,376 KB
testcase_11 AC 28 ms
5,376 KB
testcase_12 AC 66 ms
5,376 KB
testcase_13 AC 98 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 109 ms
5,376 KB
testcase_17 AC 153 ms
5,376 KB
testcase_18 AC 131 ms
5,376 KB
testcase_19 AC 164 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 0 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 40 ms
5,376 KB
testcase_30 AC 10 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:21:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |         scanf("%d %d", &l, &n);
      |         ^~~~~~~~~~~~~~~~~~~~~~
main.c:23:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |                 scanf("%d", &w[i]);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

// バブルソート
void sort(int arg[], int n) {
	int temp, i, j;

	for (i = 0; i < n - 1; i++) {
		for (j = n - 1; j > i; j--) {
			if (arg[j] < arg[j - 1]) {
				temp = arg[j];
				arg[j] = arg[j - 1];
				arg[j - 1] = temp;
			}
		}
	}
}

int main() {
	int l, n, w[10001], wt = 0, i;

	scanf("%d %d", &l, &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &w[i]);
	}

	sort(w, n);
	for (i = 0;; i++) {
		if (l >= wt + w[i]) wt += w[i];
		else break;
	}

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

	return 0;
}
0