結果

問題 No.5 数字のブロック
ユーザー yoshikiriyoshikiri
提出日時 2016-07-15 21:23:10
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 21,632 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-23 01:57:28
合計ジャッジ時間 2,859 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 0 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 44 ms
5,376 KB
testcase_04 AC 27 ms
5,376 KB
testcase_05 AC 67 ms
5,376 KB
testcase_06 AC 30 ms
5,376 KB
testcase_07 AC 20 ms
5,376 KB
testcase_08 AC 38 ms
5,376 KB
testcase_09 AC 5 ms
5,376 KB
testcase_10 AC 79 ms
5,376 KB
testcase_11 AC 19 ms
5,376 KB
testcase_12 AC 44 ms
5,376 KB
testcase_13 AC 65 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 0 ms
5,376 KB
testcase_16 AC 72 ms
5,376 KB
testcase_17 AC 102 ms
5,376 KB
testcase_18 AC 88 ms
5,376 KB
testcase_19 AC 107 ms
5,376 KB
testcase_20 RE -
testcase_21 AC 0 ms
5,376 KB
testcase_22 AC 0 ms
5,376 KB
testcase_23 AC 0 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 25 ms
5,376 KB
testcase_30 AC 7 ms
5,376 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:27:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |         scanf("%d%d",&Len,&N);
      |         ^~~~~~~~~~~~~~~~~~~~~
main.c:31:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   31 |                 scanf("%d",&Wid[i]);
      |                 ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

void sortarray(int n,int array[]){
	int i,j,min,max,temp;
	int sarray[n];

	for(i=0;i<n;i++){

		for(j=0;j<n;j++){
			if(array[j]<min){
				min = array[j];
				temp = j;
			}
			if(i>0) continue;
			if(array[j]>max) max = array[j];
		}
		sarray[i] = min;
		array[temp] = max + 1;
		min = max;
	}
	for(i=0;i<n;i++) array[i] = sarray[i];
}

int main(void){
	int i,sum=0,ans,Len,N;

	scanf("%d%d",&Len,&N);
	int Wid[N];

	for(i=0;i<N;i++){
		scanf("%d",&Wid[i]);
	}

	sortarray(N,Wid);

	for(i=0;i<N;i++){
		sum += Wid[i];
		if(sum>Len){
		ans = i;
			break;
		}
	}
	
	printf("%d\n",i);

	return 0;
}
0