A. I'm bored with life

time limit per test 1 second
memory limit per test 256 megabytes
input standard input
output standard output

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 xis 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?

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.

很久没写题,来一发水题看看自己还会不会写题了。。。

 //2017-07-11
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; long long arr[]; int main()
{
int a, b;
arr[] = ;
for(int i = ; i < ; i++){
arr[i] = arr[i-]*i;
}
while(cin>>a>>b){
cout<<arr[min(a, b)]<<endl;
} return ;
}

CodeForces822A的更多相关文章

随机推荐

  1. 文件寄生——寻找宿主的不归路(NTFS文件流实际应用)

    咱们今天来研究下NTFS文件流: NTFS文件系统实现了多文件流特性,NTFS环境一个文件默认使用的是未命名的文件流,同时可创建其他命名的文件流,windows资源管理器默认不显示出文件的命名文件流, ...

  2. underscore.js源码研究(5)

    概述 很早就想研究underscore源码了,虽然underscore.js这个库有些过时了,但是我还是想学习一下库的架构,函数式编程以及常用方法的编写这些方面的内容,又恰好没什么其它要研究的了,所以 ...

  3. cnetos6上实现nfs共享

    利用空余时间,做个nfs共享实验,岂不美滋滋!!! 系统测试环境: 主机ip 系统     主机名(服务) 192.168.241.130    centos6.5    hadoop1(nfs-sr ...

  4. AutoCompleteTextView搭配Poi搜索实现多项选择

    项目需要 需要用到AutoCompleteTextView控件,在输入之后能在下方产生一个推荐结果的列表,就类似于金山词霸一类软件.输入一两个字符就能出来一系列类似的的单词, 这里做的例子是输入城市名 ...

  5. sql开启远程访问

    我们用的是SQL Server 数据库 2008 版本,数据库配置完之后从另一台电脑访问数据库死活连接不上,提示信息如下 “ 无法连接到 *.*.*.*. 在于SQL Server建立连接时出现与网络 ...

  6. 整理的开源项目(全c#)

    NPOI:读写office办公软件(不需要安装office软件) http://npoi.codeplex.com/downloads/get/70099 消息中间件:DotNetMQ http:// ...

  7. [Umbraco] 在umbraco中开发xlst的小窍门

    当你在umbraco开发xslt时也可以调用C#里的方法,具体方法参考如下 点击第二个按钮 点击右侧的"Get Extensions" 系统自带了工具类,里面有很多常用也很实用的方 ...

  8. java ant 编译打包build.xml完整配置范例

    java ant 编译打包build.xml完整配置范例 <?xml version="1.0" encoding="UTF-8" ?> <p ...

  9. ubuntu安装ruby的几种方法总结

    1.apt-get安装 可以使用apt-cache查询功能,找到对应的可用的ruby版本. $ sudo apt-cache search ruby #这个结果很长,我只截取最后与ruby有关的部分 ...

  10. 基于.Net + SqlServer的分库分表设计方案

    在说分库分表之前,先简单介绍下网站架构,这样有助于理解为何需要分库分表这种技术.因为所有的技术,大多都是因为业务的需要而产生的. 1.网站发展的第一阶段 大致架构如下,因为没有多少用户访问,所以单台服 ...