A - I'm bored with life
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 Aand 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?
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
4 3
6
Note
Consider the sample.
4! = 1·2·3·4 = 24. 3! = 1·2·3 = 6. The greatest common divisor of integers 24 and 6is exactly 6.
#include<bits/stdc++.h>
using namespace std; int main() {
long long nums;
long long a,b;
cin>>a>>b;
long long c = min(a,b);
long long d = max(a,b);
long long sum = ;
if(c == )
sum = ;
for(long long i = c; i > ; i--)
{ sum *= i;
} cout<<sum<<endl;
return ;
}
A - I'm bored with life的更多相关文章
- Codeforces822 A I'm bored with life
A. I'm bored with life time limit per test 1 second memory limit per test 256 megabytes input standa ...
- Codeforces Round #422 (Div. 2) A. I'm bored with life 暴力
A. I'm bored with life Holidays have finished. Thanks to the help of the hacker Leha, Noora mana ...
- By virtue of|sustain|post |scrape off |stretch|access to|take into account of|exploit|hasten|blur |idle|bored her to|account for|accused of|cruelty
By virtue of this superior quality, this product is often sold out of stockin many areas. 我们的产品因其优秀的 ...
- bored
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_probl ...
- [思维题]Bored Qishen
给出一个整数集,其中包含1-n的所有整数,要求挑选出一个元素最多的子集,使得子集中任意两数的乘积不是完全平方数 (n<=10^6) 求这样一个最大子集的元素个数 #include <cst ...
- Gym 101102C Bored Judge(set--结构体集合)
这个故事告诉我们,WA了一定要找自己的原因... ... 当我开始用set去做的时候,发现一直过不去,一开始忘了把初始排名加进去,后来忘了第0秒,第0秒第一的id = 1 这个题目的做法也不只这一种, ...
- 【Codeforces Round #422 (Div. 2) A】I'm bored with life
[题目链接]:http://codeforces.com/contest/822/problem/A [题意] 让你求a!和b!的gcd min(a,b)<=12 [题解] 哪个小就输出那个数的 ...
- Programming Learning - Based on Project
Today when taking a bath I got a good idea that it is an efficient and interesting way to learn a ne ...
- Codeforces Round #384 (Div. 2) 734E Vladik and cards
E. Vladik and cards time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
随机推荐
- asterisk 通道变量
${ACCOUNTCODE}: 用户计费帐号 sip.conf 里的 account=XXXX ${ANSWEREDTIME}: 通话时长(秒) ${BLINDTRANSFER}: 通道是否为转接类型 ...
- 检查nginx配置,重载配置以及重启的方法
原文 http://blogread.cn/it/article/4549?f=hot1 几个常用的nginx命令 Nginx 安装后只有一个程序文件,本身并不提供各种管理程序,它是使用参数和系统信 ...
- 【TFS 2017 CI/CD系列 - 01】-- Agent篇
一.环境要求: PowerShell 3.0 或者更高版本 VS2015或者更高版本 二.下载Agent: 用浏览器打开TFS,[Settings]--> [Agent Pools]--> ...
- java下XML与JSON互相转换的Utils类
原文:http://heipark.iteye.com/blog/1394844 需要json-lib-2.1-jdk15.jar和xom-1.2.5.jar,maven pom.xml如下: < ...
- 使用引导光盘,将你的PC变身瘦客户机
很多国内使用VMware View桌面虚拟化产品的朋友问我,是否可以将自己现有的PC改造成一台瘦客户机呢? 一方面即可以得到桌面虚拟化的管理,安全的好处,而且连前端PC机的系统管理的工作都省了? 答案 ...
- spring mvc 整理
spring mvc 整理
- [Unit Testing] Mock an HTTP request using Nock while unit testing
When testing functions that make HTTP requests, it's not preferable for those requests to actually r ...
- [Bash] Move and Copy Files and Folders with Bash
In this lesson we’ll learn how to move and rename files (mv) and copy (cp) them. Move index.html to ...
- 【原创】PHP扩展开发入门
PHP扩展开发入门 作者:wf (360电商技术组) 在我们编写自己的第一个php扩展之前,先了解一下php的总体架构和执行机制. php的架构如图1所看到的. 当中一个重要的就是SAPI(serve ...
- Deepin-文件目录介绍
请参见这篇文件:来自一个强大的网站 我主要介绍的就是: 下面所列文件,全部添加进了path目录(Linux查找命令,请参见man.linux,无论是find 或者是 which等) Deepin默认可 ...