Advertisement
Guest User

IrerativeNK

a guest
Feb 14th, 2021
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. class MainClass
  6. {
  7.     public static void Main(string[] args)
  8.     {
  9.         int n = int.Parse(Console.ReadLine());
  10.         int k = int.Parse(Console.ReadLine());
  11.         List<int> result = new List<int>() { 1 };
  12.         for (int i = 1; i < n; i++)
  13.         {
  14.             result.Add(result.Skip(Math.Max(0, result.Count() - k)).Sum());
  15.         }
  16.         Console.WriteLine(String.Join(" ", result));
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement