Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Numerics;
- BigInteger Binomial(int n, int k) => k < 0 || k > n ? 0 : k == 0 ? 1 : k * 2 > n ? Binomial(n, n-k) : (Binomial(n, k-1) * n)/k;
- BigInteger f(int r)
- {
- BigInteger result = 0;
- for(int i = 0; i <= r; ++i) result += Binomial(30, i) * Binomial(20, r-i);
- return result;
- }
- Console.WriteLine(f(20));// 3,347,717,751,371,268
- Console.WriteLine(f(25));// 50,335,833,680,826,500
Add Comment
Please, Sign In to add comment