結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
mamo_ICE
|
| 提出日時 | 2022-12-11 11:56:40 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 457 bytes |
| コンパイル時間 | 758 ms |
| コンパイル使用メモリ | 28,928 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 09:11:58 |
| 合計ジャッジ時間 | 1,726 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <stdio.h>
int main(void){
short L, N, w[10000], i, j, tmp, l, n = 0;
scanf("%hd\n%hd\n", &L, &N);
l = tmp = L;
for(i=0; i<N; i++) scanf("%hd ", &w[i]);
while(1){
for(i=0; i<N; i++){
if(tmp >= w[i]){
tmp = w[i];
j = i;
}
}
if((l-=tmp) < 0) break;
w[j] = tmp = L + 1;
n++;
}
printf("%hd\n", n);
return 0;
}
mamo_ICE