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 ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- int[] array = new int[a*a];
- int sum = 0;
- int cnt = 0;
- array[0] = 1;
- if (a==1)
- {
- Console.WriteLine(1);
- }
- else
- {
- for (int i = 1; i < a; i++)
- {
- sum = 0;
- for (int j = 0; j < i; j++)
- {
- sum += array[j];
- }
- array[i] = sum;
- }
- for (int i = b; i <= a; i++)
- {
- sum = 0;
- for (int j = i - 1; j >= cnt; j--)
- {
- sum += array[j];
- }
- cnt++;
- array[i] = sum;
- }
- for (int n = 0; n < a; n++)
- {
- Console.Write(array[n] + " ");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement