Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Runtime.CompilerServices;
- class Solution
- {
- [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
- private static ulong Fact(ulong n)
- {
- ulong ret = 1;
- for (ulong i = 1; i <= n; i++)
- {
- ret *= i;
- }
- return ret;
- }
- [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
- private static ulong C(ulong n, ulong r) => Fact(n) / (Fact(r) * Fact(n - r));
- public static void Main()
- {
- int tests = Int32.Parse(Console.ReadLine()!);
- for (int testNo = 0; testNo < tests; testNo++)
- {
- ulong[] input = Console.ReadLine()!.Split(' ', 4).Select(UInt64.Parse).ToArray();
- Console.WriteLine(C(input[2], input[0]) * C(input[3], input[1]));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement