結果

問題 No.5 数字のブロック
ユーザー pracode
提出日時 2018-09-17 16:53:17
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 28,416 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 07:46:17
合計ジャッジ時間 937 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int l,n;
    int w[10000];
    int i;
    int sumlength=0;
    int curnum=0;
    
    scanf("%d%d",&l,&n);
    for(i=0;i<n;i++){
        scanf("%d",&w[i]);
        sumlength+=w[i];
        curnum+=1;
        
        if(sumlength>l){
            printf("%d\n",curnum-1);
            exit(0);
        }
    }
    printf("%d\n",n);
    return 0;
}
0