A10996 | I'm bored with life
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her dreams which is located in a town Pavlopolis. It's well known that universities provide students with dormitory for the period of university studies. Consequently Noora had to leave Vičkopolis and move to Pavlopolis. Thus Leha was left completely alone in a quiet town Vičkopolis. He almost even fell into a depression from boredom!
Leha came up with a task for himself to relax a little. He chooses two integers $A$ and $B$ and then calculates the greatest common divisor of integers " $A$ factorial" and " $B$ factorial". Formally the hacker wants to find out GCD $(A!,B!)$ . It's well known that the factorial of an integer $x$ is a product of all positive integers less than or equal to $x$ . Thus $x!=1·2·3·...·(x-1)·x$ . For example $4!=1·2·3·4=24$ . Recall that GCD $(x,y)$ is the largest positive integer $q$ that divides (without a remainder) both $x$ and $y$ .
Leha has learned how to solve this task very effective. You are able to cope with it not worse, aren't you?
Leha came up with a task for himself to relax a little. He chooses two integers $A$ and $B$ and then calculates the greatest common divisor of integers " $A$ factorial" and " $B$ factorial". Formally the hacker wants to find out GCD $(A!,B!)$ . It's well known that the factorial of an integer $x$ is a product of all positive integers less than or equal to $x$ . Thus $x!=1·2·3·...·(x-1)·x$ . For example $4!=1·2·3·4=24$ . Recall that GCD $(x,y)$ is the largest positive integer $q$ that divides (without a remainder) both $x$ and $y$ .
Leha has learned how to solve this task very effective. You are able to cope with it not worse, aren't you?
输入格式
The first and single line contains two integers $A$ and $B$ $(1<=A,B<=10^{9},min(A,B)<=12)$ .
输出格式
Print a single integer denoting the greatest common divisor of integers $A!$ and $B!$ .
输入输出样例
输入 #1
4 3
输出 #1
6
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$ .
$4!=1·2·3·4=24$ . $3!=1·2·3=6$ . The greatest common divisor of integers $24$ and $6$ is exactly $6$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted