結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-03 09:29:32 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 530 bytes |
| コンパイル時間 | 377 ms |
| コンパイル使用メモリ | 25,088 KB |
| 実行使用メモリ | 8,224 KB |
| 最終ジャッジ日時 | 2025-03-03 09:29:45 |
| 合計ジャッジ時間 | 13,398 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 33 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
4 | scanf("%d\n",&l);
| ^~~~~~~~~~~~~~~~
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d\n",&n);
| ^~~~~~~~~~~~~~~~
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d ",&w[i] );
| ^~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
void main(void){
int l = 0 ;
scanf("%d\n",&l);
int n = 0;
scanf("%d\n",&n);
int w[n];
int i;
for(i = 0 ; i < n ; i++ ){
scanf("%d ",&w[i] );
if( i = 0 ){
continue;
}
for(int j = 0 ; j < i ; j++ ){
if(w[i] < w[j]){
int sum = w[i];
w[i] = w[j];
w[j] = sum;
}
}
}
i = 0;
while(l > 0){
l = l - w[i];
i++;
}
printf("%d個\n",i);
}
Maeda