Skip to content

Instantly share code, notes, and snippets.

@unilecs
Created February 5, 2018 02:09
Show Gist options
  • Save unilecs/78e6bd8cfb827ba91dfc0ca04a23716e to your computer and use it in GitHub Desktop.
Save unilecs/78e6bd8cfb827ba91dfc0ca04a23716e to your computer and use it in GitHub Desktop.
Задача 68: Две цифры
using System;
public class Program
{
public static int GetCount(int n)
{
int Max = 32;
if (n > Max) return -1;
int[] arr = new int[Max];
arr[1] = 2;
arr[2] = 4;
for (int i = 3; i <= n; i++)
{
arr[i] = arr[i - 1] + arr[i - 2];
}
return arr[n];
}
public static void Main()
{
Console.WriteLine("UniLecs");
Console.WriteLine(string.Format("Answer = {0}", GetCount(3))); // 6
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment