Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace daysofweek
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int k = int.Parse(Console.ReadLine());
- long[] arr = new long[n];
- arr[0] = 1;
- for (int i = 1; i < n; i++)
- {
- long sum = 0;
- for (int j = i-1; j >=0 && j >= i-k; j--)
- {
- sum += arr[j];
- }
- arr[i] = sum;
- }
- Console.WriteLine(string.Join(" ", arr));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement