# Introduction

This time, in the ABC132_D problem of the AtCoder content, the WA (incorrect answer) of what I thought was not covered, and why was the output incorrect in my implementation? I posted it because I wanted to solve the fundamental problem. In addition, the input examples 1 and 2 posted in the problem have been cleared.

# Problem statement (quote)

Quote page: https://atcoder.jp/contests/abc132/tasks/abc132_d --- Start quoting --- There are K blue balls and N-K red balls. Balls of the same color are indistinguishable. Sunuke and Takahashi are playing with these balls.

First, Sunuke arranges N balls in a row from left to right.

Next, Mr. Takahashi, of these, K Collect only one blue ball. Takahashi can collect as many blue balls as he wants in a row with a single operation. Takahashi always acts to minimize the number of operations required to collect K blue balls.

How many ways can Takahashi arrange the balls that he needs to operate exactly i times to collect K blue balls? Calculate the answer for each of 1 ≤ i ≤ K and answer the remainder divided by 10 ^ 9 + 7.

Constraint 1≤K≤N≤2000

input Input is given from standard input in the following format.

N K

output On line i (1 ≤ i ≤ K), output the remainder of the total number of ball arrangements that Takahashi needs to operate exactly i times divided by 10 ^ 9 + 7. --- End of quote ---

# Implementation (WA judgment)

#### `Main.java`

``````
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
sc.close();

for(int i = 1;i <= K;i++) {
long combi1 = combination(N-K+1,i);
long combi2 = combination(K-1,i-1);
System.out.println(combi1*combi2%1_000_000_007);
}
}

public static long combination(int i,int j) {
if(j==0) {
return 1;
}
return combination(i-1,j-1)* i  / j;
}
}
``````

I would be grateful if you could point out the above.