@@ -0,0 +1,754 @@
+import java.util.Arrays;%0Aimport java.util.Scanner;%0A%0Apublic class LastKNumbersSums %7B%0A    public static void main(String%5B%5D args) %7B%0A        Scanner scanner = new Scanner(System.in);%0A        int n = Integer.parseInt(scanner.nextLine());%0A        int k = Integer.parseInt(scanner.nextLine());%0A%0A        long%5B%5D numberArray = new long%5Bn%5D;%0A        numberArray%5B0%5D = 1;%0A%0A        for (int i = 1; i %3C n; i++) %7B%0A            long sum = 0;%0A%0A            for (int previous = i - k; previous %3C= i - 1; previous++) %7B%0A                if (previous %3E= 0) %7B%0A                    sum += numberArray%5Bprevious%5D;%0A                %7D%0A            %7D%0A            numberArray%5Bi%5D = sum;%0A        %7D%0A%0A        Arrays.stream(numberArray).forEach(number -%3E System.out.print(number + %22 %22));%0A    %7D%0A%7D%0A

Create 03.LastKNumbersSums.java