acm第三次周賽C題反省

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ù)一定是小的階乘 非常簡單的一個題目,卻被我搞復雜

  1. 當時可能心態(tài)有問題 不是很冷靜下來分析題目
  2. 對題目的分析有待提高
    程序說明:
    程序如下:
#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;
}
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容