QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#22678 | #2142. Yurik and Woodwork Lesson | LFCode# | AC ✓ | 6ms | 8940kb | C++14 | 1.5kb | 2022-03-10 15:16:56 | 2022-04-30 01:32:01 |
Judging History
answer
#include<bits/stdc++.h>
#include<cstdio>
#include<cctype>
#define ll long long
#define PI pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define ui unsigned int
#define pb push_back
#define llu long long unsigned
using namespace std;
const int MB=1<<20;
struct FastIO{
char ib[MB+100],*p,*q;
char ob[MB+100],*r,stk[128];
int tp;
FastIO(){p=q=ib,r=ob,tp=0;}
~FastIO(){fwrite(ob,1,r-ob,stdout);}
char read_char(){if(p==q){p=ib,q=ib+fread(ib,1,MB,stdin);if(p==q)return 0;}return *p++;}
template<typename T>
void read_int(T& x){char c=read_char(),l=0;for(x=0;!isdigit(c);c=read_char())l=c;for(;isdigit(c);c=read_char())x=x*10-'0'+c;if(l=='-')x=-x;}
void write_char(char c){if(r-ob==MB)r=ob,fwrite(ob,1,MB,stdout);*r++=c;}
template<typename T>
void write_int(T x){if(x<0)write_char('-'),x=-x;do stk[++tp]=x%10+'0';while(x/=10);while(tp)write_char(stk[tp--]);}
}IO;
//IO.read_int(a);c=IO.read_char();IO.write_int(a);//IO.write_char(c);
const int N=200010,mod=998244353;
int T,n,m,a[N],fac[N],inv[N],invfac[N];
int C(int x,int y){
return fac[x]*1ll*invfac[y]%mod*invfac[x-y]%mod;
}
int main(){
// scanf("%d",&T);
T=1;
fac[0]=fac[1]=invfac[0]=invfac[1]=inv[0]=inv[1]=1;
for(int i=2;i<=N-1;i++){
fac[i]=fac[i-1]*1ll*i%mod;
inv[i]=inv[mod%i]*1ll*(mod-mod/i)%mod;
invfac[i]=invfac[i-1]*1ll*inv[i]%mod;
}
while(T--){
scanf("%d%d",&n,&m);
printf("%d\n",C(m+n-2,n-1)*1ll*inv[n]%mod*C(m+n-1,n-1)%mod);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 5ms
memory: 7012kb
input:
2 2
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 5ms
memory: 8260kb
input:
2 4
output:
10
result:
ok 1 number(s): "10"
Test #3:
score: 0
Accepted
time: 2ms
memory: 7732kb
input:
100 100
output:
818380736
result:
ok 1 number(s): "818380736"
Test #4:
score: 0
Accepted
time: 3ms
memory: 8704kb
input:
1 1
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 2ms
memory: 8388kb
input:
1 2
output:
1
result:
ok 1 number(s): "1"
Test #6:
score: 0
Accepted
time: 5ms
memory: 8580kb
input:
1 3
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 5ms
memory: 8736kb
input:
1 4
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: 0
Accepted
time: 2ms
memory: 8360kb
input:
1 5
output:
1
result:
ok 1 number(s): "1"
Test #9:
score: 0
Accepted
time: 2ms
memory: 7228kb
input:
2 1
output:
1
result:
ok 1 number(s): "1"
Test #10:
score: 0
Accepted
time: 5ms
memory: 7464kb
input:
2 2
output:
3
result:
ok 1 number(s): "3"
Test #11:
score: 0
Accepted
time: 2ms
memory: 7056kb
input:
2 3
output:
6
result:
ok 1 number(s): "6"
Test #12:
score: 0
Accepted
time: 5ms
memory: 8008kb
input:
2 4
output:
10
result:
ok 1 number(s): "10"
Test #13:
score: 0
Accepted
time: 5ms
memory: 8096kb
input:
2 5
output:
15
result:
ok 1 number(s): "15"
Test #14:
score: 0
Accepted
time: 1ms
memory: 7964kb
input:
3 1
output:
1
result:
ok 1 number(s): "1"
Test #15:
score: 0
Accepted
time: 6ms
memory: 7060kb
input:
3 2
output:
6
result:
ok 1 number(s): "6"
Test #16:
score: 0
Accepted
time: 6ms
memory: 7444kb
input:
3 3
output:
20
result:
ok 1 number(s): "20"
Test #17:
score: 0
Accepted
time: 5ms
memory: 7052kb
input:
3 4
output:
50
result:
ok 1 number(s): "50"
Test #18:
score: 0
Accepted
time: 0ms
memory: 8916kb
input:
3 5
output:
105
result:
ok 1 number(s): "105"
Test #19:
score: 0
Accepted
time: 5ms
memory: 6928kb
input:
4 1
output:
1
result:
ok 1 number(s): "1"
Test #20:
score: 0
Accepted
time: 2ms
memory: 8772kb
input:
4 2
output:
10
result:
ok 1 number(s): "10"
Test #21:
score: 0
Accepted
time: 6ms
memory: 7712kb
input:
4 3
output:
50
result:
ok 1 number(s): "50"
Test #22:
score: 0
Accepted
time: 5ms
memory: 8056kb
input:
4 4
output:
175
result:
ok 1 number(s): "175"
Test #23:
score: 0
Accepted
time: 0ms
memory: 6996kb
input:
4 5
output:
490
result:
ok 1 number(s): "490"
Test #24:
score: 0
Accepted
time: 2ms
memory: 7680kb
input:
5 1
output:
1
result:
ok 1 number(s): "1"
Test #25:
score: 0
Accepted
time: 6ms
memory: 8940kb
input:
5 2
output:
15
result:
ok 1 number(s): "15"
Test #26:
score: 0
Accepted
time: 3ms
memory: 7260kb
input:
5 3
output:
105
result:
ok 1 number(s): "105"
Test #27:
score: 0
Accepted
time: 0ms
memory: 6924kb
input:
5 4
output:
490
result:
ok 1 number(s): "490"
Test #28:
score: 0
Accepted
time: 5ms
memory: 8472kb
input:
5 5
output:
1764
result:
ok 1 number(s): "1764"
Test #29:
score: 0
Accepted
time: 1ms
memory: 8896kb
input:
1 9
output:
1
result:
ok 1 number(s): "1"
Test #30:
score: 0
Accepted
time: 2ms
memory: 8448kb
input:
8 4
output:
4950
result:
ok 1 number(s): "4950"
Test #31:
score: 0
Accepted
time: 2ms
memory: 8352kb
input:
2 48
output:
1176
result:
ok 1 number(s): "1176"
Test #32:
score: 0
Accepted
time: 5ms
memory: 8140kb
input:
57 4
output:
278114495
result:
ok 1 number(s): "278114495"
Test #33:
score: 0
Accepted
time: 5ms
memory: 7216kb
input:
82 51
output:
501711451
result:
ok 1 number(s): "501711451"
Test #34:
score: 0
Accepted
time: 2ms
memory: 7140kb
input:
4909 1
output:
1
result:
ok 1 number(s): "1"
Test #35:
score: 0
Accepted
time: 5ms
memory: 8428kb
input:
30 3890
output:
146479684
result:
ok 1 number(s): "146479684"
Test #36:
score: 0
Accepted
time: 5ms
memory: 8576kb
input:
2081 3619
output:
991511011
result:
ok 1 number(s): "991511011"
Test #37:
score: 0
Accepted
time: 6ms
memory: 7704kb
input:
9511 10
output:
282597455
result:
ok 1 number(s): "282597455"
Test #38:
score: 0
Accepted
time: 5ms
memory: 7208kb
input:
21 36014
output:
305749705
result:
ok 1 number(s): "305749705"
Test #39:
score: 0
Accepted
time: 2ms
memory: 7508kb
input:
10049 6765
output:
275321949
result:
ok 1 number(s): "275321949"
Test #40:
score: 0
Accepted
time: 5ms
memory: 8456kb
input:
13036 23902
output:
885509275
result:
ok 1 number(s): "885509275"
Test #41:
score: 0
Accepted
time: 2ms
memory: 7348kb
input:
1 100000
output:
1
result:
ok 1 number(s): "1"
Test #42:
score: 0
Accepted
time: 5ms
memory: 7536kb
input:
100000 1
output:
1
result:
ok 1 number(s): "1"
Test #43:
score: 0
Accepted
time: 5ms
memory: 8228kb
input:
98765 95678
output:
302812642
result:
ok 1 number(s): "302812642"
Test #44:
score: 0
Accepted
time: 2ms
memory: 7108kb
input:
100000 100000
output:
174524777
result:
ok 1 number(s): "174524777"