Codeforces Round #422 A

I‘m bored with life

题意:给一个a,b,求 gcd(a!,b!),输出min(a,b)! 就可以了

AC代码:

#include<bits/stdc++.h>
#include "iostream"
#include "string.h"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "set"
#include "map"
#include "algorithm"
#include "stdio.h"
#include "math.h"
#define ll long long
#define bug(x) cout<<x<<" "<<"UUUUU"<<endl;
#define mem(a) memset(a,0,sizeof(a))
#define mp(x,y) make_pair(x,y)
#define pb push_back
const long long INF = 1e18+1LL;
const int inf = 1e9+1e8;
using namespace std;
const int N=1e5+100;

ll a,b,ans=1;
int main(){
    cin>>a>>b;
    for(int i=2; i<=min(a,b); ++i){
        ans*=i;
    }
    cout<<ans<<endl;
    return 0;
}
时间: 2024-08-28 04:44:00

Codeforces Round #422 A的相关文章

Codeforces Round #422 (Div. 2) D. My pretty girl Noora

题目链接:Codeforces Round #422 (Div. 2) D. My pretty girl Noora 题意: 给你一个数n和t,l,r,让你求 t0·f(l)?+?t1·f(l?+?1)?+?...?+?tr?-?l·f(r). 其中f(n)是n个人的最少比较次数. 比如n为4,可以先2 2分,然后胜出2个人,最后再比较一次,所以f(4)=3. f(3)=3,因为3为质数,只能这样分. 题解: 这题半天没看清楚题意啊.- -!以为是任意分. 结果是选一个数x,每组都必须为x个人

Codeforces Round #422 (Div. 2) A. I&#39;m bored with life 暴力

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

Codeforces Round #422 (Div. 2) C. Hacker, pack your bags! 排序+贪心

链接: http://codeforces.com/contest/822/problem/C 题意: 有x天的假期, 有n张旅行票, 每张票有起始时间l, 结束时间r, 花费cost, 想把假期分成两部分出去旅游, 两部分时间不能重合(ri < lj || rj < li), 问最小花费是多少, 如果不能两部分, 输出-1 题解: CF官方解法, 效率O(nlogn2) 设置一个结构体, struct P{int p, len, cost, type}; 将每张票(l, r, cost) 表

Codeforces Round #422 (Div. 2) C Hacker, pack your bags!

It's well known that the best way to distract from something is to do one's favourite thing. Job is such a thing for Leha. So the hacker began to work hard in order to get rid of boredom. It means that Leha began to hack computers all over the world.

Codeforces Round #422 B

Crossword solving 题意:给2个字符串s1,s2,求至少改变s2的多少个字符,才能使s2中包含s1,并输出改变的位置 思路:暴力枚举以每一个位置为开始,和s2匹配,求答案 AC代码: #include<bits/stdc++.h> #include "iostream" #include "string.h" #include "stack" #include "queue" #include &q

Codeforces Round #422 C

Hacker, pack your bags! 题意:给n个区间,每个区间的长度为ri-li+1,权值为ci,选取2个不相交的区间,长度加起来为x,且权值和最小 思路:遍历 l ,vi[l]存起点为l的区间的权值最小值,每次加入li==l的区间更新vi的值,更新后再更新ri==l-1的答案,这样可以保证,每次选择一个区间后,从vi里选择的另一个区间一定是不相交的 AC代码: #include<bits/stdc++.h> #include "iostream" #inclu

codeforces round 422 div2 补题 CF 822 A-F

A I'm bored with life 水题 #include<bits/stdc++.h> using namespace std; typedef long long int LL; const LL N=1,M=1,MOD=1; int main() {//freopen("t.txt","r",stdin); ios::sync_with_stdio(false); LL a,b; scanf("%I64d%I64d",&

Codeforces Round #422 (Div. 2) A-C

A. I'm bored with life 水题 #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <queue> #include <vector> #include <iomanip> #include <math.h> #include <map> using name

Codeforces Round #422 (Div. 2) E. Liar 后缀数组+RMQ+DP

E. Liar The first semester ended. You know, after the end of the first semester the holidays begin. On holidays Noora decided to return to Vi?kopolis. As a modest souvenir for Leha, she brought a sausage of length m from Pavlopolis. Everyone knows th