daily pastebin goal
35%
SHARE
TWEET

Хорошие строки

a guest Jan 17th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace ConsoleApplication70
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int temp1 = 5001, temp2 = 1000000007;
  10.             Int64[,] mass = new Int64[temp1, temp1];
  11.             for (int i = 0; i < temp1; i++)
  12.             {
  13.                 mass[i, 0] = 0;
  14.                 mass[i, i] = 1;
  15.             }
  16.             for (int i = 0; i < temp1; i++)
  17.             {
  18.                 for(int j = 1; j <= i - 1; j++)
  19.                     mass[i, j] = ((mass[i - 1, j - 1]) % temp2 + j * mass[i - 1, j] % temp2) % temp2;
  20.             }
  21.             int n = int.Parse(Console.ReadLine());
  22.             Int64 sum = 0;
  23.             for(int i = 0; i <= n; i++)
  24.                 sum = (sum + mass[n, i]) % temp2;
  25.             sum++;
  26.             Console.WriteLine(sum);
  27.         }
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top