← All problemsSign in

FACT GCD2

You are given two numbers A & B. You are required to calculate gcd(A!,B!) Note ! means factorial. Input The first line contains T. Then T test cases follow. Each test case contains two space-separated integers A and B Output For each test case Print a single integer denoting the greatest common divisor of integers A! and B!. Constraints 1 ≤ T ≤ 10 1 ≤ A,B ≤ 109 min(A,B)≤12 Example Input:

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start