結果

問題 No.5 数字のブロック
ユーザー mamo_ICE
提出日時 2022-12-11 11:46:17
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-15 09:03:26
合計ジャッジ時間 1,761 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 = 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;
}
0