Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- class numberOfCombinations
- {
- static void Main()
- {
- BigInteger n = BigInteger.Parse(Console.ReadLine());
- BigInteger k = long.Parse(Console.ReadLine());
- BigInteger nFactoriel = 1;
- BigInteger kFactoriel = 1;
- BigInteger nkFactoriel = 1;
- if (n > 1 && n < 100 && k > 1 && k < 100 && k < n)
- {
- for (int i = 0; i < n; i++)
- {
- nFactoriel *= n - i;
- if (k-i > 0)
- {
- kFactoriel *= k - i;
- }
- if (n-k-i > 0)
- {
- nkFactoriel *= (n - k) - i;
- }
- }
- }
- Console.WriteLine(nFactoriel / (kFactoriel * nkFactoriel));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement