結果

問題 No.5 数字のブロック
ユーザー book_nobless
提出日時 2015-08-13 23:13:26
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 3,004 ms
コンパイル使用メモリ 74,004 KB
実行使用メモリ 47,080 KB
最終ジャッジ日時 2024-07-18 09:17:02
合計ジャッジ時間 9,305 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 24 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No5 {
    public static void main (String[] args){
        int L, N;
        Scanner sc = new Scanner(System.in);

        L = sc.nextInt();
        N = sc.nextInt();
        int[] W = new int[N + 1];
        int i;
        for(i = 0 ; i < N ; i++){
            W[i] = sc.nextInt();
        }

        L -= W[i];
        int count = 0;
        while(L >= 0){
            count++;
            i--;
            L -= W[i];    
        }

        System.out.println(count);
    }
}
0