Codeforces822 A I'm bored with life
1 second
256 megabytes
standard input
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 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 ≤ 109, min(A, B) ≤ 12).
Print a single integer denoting the greatest common divisor of integers A! and B!.
4 3
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.
——————————————————————-————————-——
题目的意思是给出两个数求这两个数的阶乘的gcd
思路:gcd一定是较小的数的阶乘
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <climits>
using namespace std; #define LL long long
const int INF = 0x3f3f3f3f;
int main()
{
int a[15],x,y;
a[1]=1;
for(int i=2;i<=12;i++)
a[i]=a[i-1]*i;
scanf("%d%d",&x,&y);
printf("%d\n",a[min(x,y)]);
return 0;
}
Codeforces822 A I'm bored with life的更多相关文章
- Codeforces822 B. Crossword solving
B. Crossword solving time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 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 这个题目的做法也不只这一种, ...
- Codeforces822 C. Hacker, pack your bags!
C. Hacker, pack your bags! time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- A - I'm bored with life
Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university ...
- 【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 [题解] 哪个小就输出那个数的 ...
随机推荐
- mysql mysqld.sock文件丢失问题
修改mysql 编码为utf8时 在/etc/mysql/目录下 在 [client] 添加 default-character-set=utf8 [mysqld]添加 default-charact ...
- 4. 深入 Python 流程控制
除了前面介绍的 while 语句,Python 还从其它语言借鉴了一些流程控制功能,并有所改变. 4.1. if 语句 也许最有名的是 if 语句.例如: >>> x = int(i ...
- PAT 1023 组个最小数 (20)(代码+思路)
1023 组个最小数 (20)(20 分) 给定数字0-9各若干个.你可以以任意顺序排列这些数字,但必须全部使用.目标是使得最后得到的数尽可能小(注意0不能做首位).例如:给定两个0,两个1,三个5, ...
- Startup.国外新锐公司及其技术Blog
国外技术公司Tech/Engineering Blog 1. vimeo https://coderwall.com/team/vimeo http://blog.assembly.com/ 2. l ...
- 基因组表达分析:如何选择RNA-seq vs. 芯片
基因组表达分析:如何选择RNA-seq vs. 芯片 发布日期:2017-03-29 10:00 DNA 芯片(上图左侧)由附着在表面的核酸探针组成.首先,从样品中提取 RNA 并转化为互补 DNA( ...
- 详解php多人开发环境原理
作为一名php开发人员,有时候一个项目或一个功能我们不能独自完成,就像当一个仓库开发人员大于1,20人的时候,每个人可能开发不同的模块和功能,用代码版本控制工具比如 git 开不同的分支,流程大概是先 ...
- 如何修改隐藏Zblog/WordPress默认后台登录地址
我相信很多博主站长都遇到过站点被暴力破解,虽然未被破解,但是经常收到那些尝试登录失败的邮件提醒也会心慌慌的.对于这种情况,最好的办法就是修改/隐藏我们的后台登录地址. 关于zblogASP后台登录地址 ...
- NC 6系预警类型注册
在实际开发预警任务中,因为模块是新创建的,所以开发预警,就要在相应的节点模块注册.但这样代码就得放在相应的模块中,注册个预警类型,就可以把代码直接放在自己新建的模块. .先执行新建模块语句 inser ...
- Linux网络端口命名规则,一致性网络设备命名
参考文档: https://www.cnblogs.com/pipci/p/9229571.html 一致性网络设备命名,即Consistent Network Device Naming. 一.服务 ...
- sqli-labs:7,导入导出;8-10 延时注入
1,Load_file()导出文件 使用条件: A.必须有权限读取并且文件必须完全可读(and (select count(*) from mysql.user)>0/* 如果结果返回正常,说明 ...