結果

問題 No.5 数字のブロック
ユーザー arutairuarutairu
提出日時 2021-08-21 22:13:49
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 421 bytes
コンパイル時間 544 ms
コンパイル使用メモリ 30,208 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-23 13:13:04
合計ジャッジ時間 3,374 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 92 ms
5,376 KB
testcase_04 AC 59 ms
5,376 KB
testcase_05 AC 160 ms
5,376 KB
testcase_06 AC 61 ms
5,376 KB
testcase_07 AC 40 ms
5,376 KB
testcase_08 AC 79 ms
5,376 KB
testcase_09 AC 10 ms
5,376 KB
testcase_10 AC 184 ms
5,376 KB
testcase_11 AC 37 ms
5,376 KB
testcase_12 AC 98 ms
5,376 KB
testcase_13 AC 148 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 164 ms
5,376 KB
testcase_17 AC 230 ms
5,376 KB
testcase_18 AC 198 ms
5,376 KB
testcase_19 AC 252 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 54 ms
5,376 KB
testcase_30 AC 12 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
 int main(void)
{
	int l;
	int n;
	int w[100001];
	int i;
	int j;
	int temp;
	int sum=0;
	int c=0;
	scanf("%d",&l);
	scanf("%d",&n);
	for(i=0;i<n;i++){
		
		scanf("%d",&w[i]);
		
	}
	for(i=n-1;i>=0;i--){
		for(j=0;j<i;j++){
			if(w[j]>w[j+1]){
				temp=w[j];
				w[j]=w[j+1];
				w[j+1]=temp;
			}
		}
	}
	i=0;
	while((sum+=w[i])<=l){
		i++;
		c++;
	}
	printf("%d\n",c);
 	return 0;
}
0