Input
The first and single line contains two integers A and B (1?≤?A,?B?≤?109,?min(A,?B)?≤?12).
Output
Print a single integer denoting the greatest common divisor of integers A! and B!.
Example
Input
4 3
Output
6
Note
Consider the sample.
4!?=?1·2·3·4?=?24. 3!?=?1·2·3?=?6. The greatest common divisor of integers 24 and 6 is exactly 6.
問題鏈接:https://cn.vjudge.net/contest/276590#problem/C
問題簡述:求兩個數(shù)的公約數(shù)
問題分析:求的是兩個階乘數(shù)的公約數(shù),理解偏題目意思,實際上都是階乘那么最大公約數(shù)一定是小的階乘 非常簡單的一個題目,卻被我搞復雜
- 當時可能心態(tài)有問題 不是很冷靜下來分析題目
- 對題目的分析有待提高
程序說明:
程序如下:
#include<iostream>
using namespace std;
int main()
{
int A, B, sum1, sum2;
cin >> A >> B;
sum1 = 1; sum2 = 1;
for (int i = 1; i <= A; i++)
{
sum1 = sum1 * i;
}
for (int i = 1; i <= B; i++)
{
sum2 = sum2 * i;
}
if (A >= B)cout << sum2;
else cout << sum1;
system(" PAUSE");
return 0;
}