結果

問題 No.5 数字のブロック
ユーザー Maeda
提出日時 2025-03-07 11:55:34
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 833 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 25,856 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-07 11:55:37
合計ジャッジ時間 3,104 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

void main(){
	//大きな箱のサイズと箱の数
	int l = 0 ;
	int input = scanf("%d\n",&l);
	if(input == 2){
		printf("入力ミス\n");
	}
	int n = 0 ;
	input = scanf("%d\n",&n);
	if(input == 2){
		printf("入力ミス\n");
	}
	int sizeList[n];
	for(int i = 0 ; i  < n ; i ++ ){
		int inputList = scanf("%d\n",&sizeList[i]);
		if(inputList == 2){
			printf("入力ミス\n");
		}
	}
	
	for(int i = 0 ; i < n ; i++ ){
		for(int j  = 0 ; j < n ; j++ ){
			if(sizeList[i] < sizeList[j]){
				int num = sizeList[i];
				sizeList[i] = sizeList[j];
				sizeList[j] = num;
			}
		}
	}

	int count = 0;
	while( l > 0 ){
		l = l - sizeList[count];
		count++;
	}
	
	if(count != n && l != 0){
		if(count != n){
			//printf("一致しない");
		}
		count--;
	}
	if(count < 0){
		count = 0;
	}
	printf("%d\n",count);
}
0