Codeforces Round #422 (Div. 2) A. I'm bored with life
来源:互联网 发布:如东知品服饰有限公司 编辑:程序博客网 时间:2024/05/16 07:34
题目大意
给出两个数,计算阶乘的gcd。
题解
阶乘gcd其实就是较小数的阶乘。
复杂度o(min(a,b)).
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int read(){ char ch=getchar();int f=0; while(ch<'0'||ch>'9') ch=getchar(); while(ch>='0'&&ch<='9') {f=(f<<1)+(f<<3)+ch-'0'; ch=getchar();} return f;}int gcd(int a,int b){ return !b?a:gcd(b,a%b);}int main(){ int a=read(),b=read(),x,s=1; x=min(a,b); int ans=1; for(int i=1;i<=x;i++) s*=i; cout<<s;}
阅读全文
0 0
- Codeforces Round #422 (Div. 2) A I'm bored with life
- Codeforces Round #422 (Div. 2) A. I'm bored with life
- Codeforces Round #422 A. I'm bored with life
- codeforces 822 A I'm bored with life
- CodeForces 822A I'm bored with life
- codeforces 822A(I'm bored with life) Java
- Codeforces 822A I'm bored with life
- I'm bored with life (Codeforces 822A)
- codeforces 822A I'm bored with life
- Codeforces822 A I'm bored with life
- A. I'm bored with life
- A. I'm bored with life
- I'm bored with life
- I'm bored with life
- 0706 CF#822A-I'm bored with life #822B-Crossword solving
- I'm bored~~~
- Codeforces Round #140 (Div. 2) A. Where do I Turn?
- Codeforces Round #133 (Div. 2) A. Tiling with Hexagons(数学)
- 二叉树的层序遍历详细讲解(附完整C++程序)
- 机器学习入门基础文章
- CentOS6.7成功安装sbt
- POJ 2195 Going Home <最小费用最大流>
- react-native 从简单的事件分发来介绍redux
- Codeforces Round #422 (Div. 2) A. I'm bored with life
- mysql储存过程遇到的坑(while 循环中,select count(*) 总是返回0的解决方案 )
- 我的第一个Hbuilder项目
- Java连接数据库
- sizeof的那些事儿
- 利用Immutable解决React-Native那些因为对象被篡改导致的多次render问题
- STM8S TIM1/TIM2 初始化函数
- Html标签解释及使用方法
- python快速入门(5)字典结构