package test1; import java.util.Scanner; public class test1_class { public static void main(String[] args) { // 標準入力から読み込む際に、Scannerオブジェクトを使う。 Scanner sc = new Scanner(System.in); int L = sc.nextInt(); sc.nextLine(); int N = sc.nextInt(); sc.nextLine(); int[] W = new int[10000]; for(int i=0; i= 0; i++) { L -= W[i]; num++; //全部入った場合 if(i >= N) { L = -1; } } System.out.println(num-1 + "\n"); } }