Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ExamPreparation
- {
- class Startup
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int k = int.Parse(Console.ReadLine());
- long[] numbers = new long[n];
- List<long> summed = new List<long>();
- numbers[0] = 1;
- summed.Add(numbers[0]);
- int counter = 1;
- for (int i = 1; i < numbers.Length; i++)
- {
- counter++;
- if (counter > k)
- {
- counter = 1;
- }
- numbers[i] = summed.Sum();
- summed.Add(numbers[i]);
- if (summed.Count > k)
- {
- summed.RemoveAt(0);
- }
- }
- Console.WriteLine(string.Join(" ", numbers));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment