水题。
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* 题意:求最大公约数:gcd(A!,B!) = min(A,B)!
*
* @author tinydolphin
*
*/
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int inputA;
int inputB;
int min;
int result;
while (in.hasNext()) {
inputA = in.nextInt();
inputB = in.nextInt();
result = 1;
min = inputA < inputB ? inputA : inputB;
for (int lo = 2; lo <= min; lo++) {
result *= lo;
}
out.println(result);
}
out.flush();
}
}