結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
ふっぴー
|
| 提出日時 | 2017-03-30 16:34:37 |
| 言語 | C90 (gcc 15.3.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 154 ms / 5,000 ms |
| + 845µs | |
| コード長 | 574 bytes |
| 記録 | |
| コンパイル時間 | 62 ms |
| コンパイル使用メモリ | 36,864 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-24 23:17:52 |
| 合計ジャッジ時間 | 2,741 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#define INF 1000000000;
#include <stdio.h>
int main(void)
{
int BoxW,N,BlockW[10000],i;
scanf("%d%d",&BoxW,&N);
for(i=0;i<N;i++){
scanf("%d",&BlockW[i]);
}
int j,temp;
for(i=0;i<N;i++){
for(j=i+1;j<N;j++){
if( BlockW[i] > BlockW[j] ){
temp= BlockW[i];
BlockW[i]=BlockW[j];
BlockW[j]=temp;
}
}
}
int total=0;
int count=0;
for(i=0;i<N;i++){
total = total + BlockW[i];
if(total <= BoxW){
count++;
}else{
break;
}
}
printf("%d\n",count);
return 0;
}
ふっぴー