Codeforces Round #422 A. I'm bored with life

来源:互联网 发布:lol遇到一个网络问题 编辑:程序博客网 时间:2024/05/16 07:46

题目网址: Codeforces Round #422 A. I’m bored with life

题意分析:

  • 题意:求 gcd(a!, b!)
  • 分析显然最大公约数就是 min(a!, b!)

代码:

#include <iostream>#include <algorithm>using namespace std;int main(int argc, char const *argv[]){    int a, b;    int ans, mn;    while (~scanf("%d %d", &a, &b))    {        ans = 1;        mn = min(a, b);        while (mn)        {            ans *= mn;            --mn;        }        printf("%d\n", ans);    }    return 0;}
原创粉丝点击