QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#620282#8149. Station of FatePepinotWA 0ms3748kbC++20740b2024-10-07 17:20:262024-10-07 17:20:26

Judging History

你现在查看的是最新测评结果

  • [2024-10-07 17:20:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3748kb
  • [2024-10-07 17:20:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=998244353;
ll an[100005];
signed main() {
    ios::sync_with_stdio(false),cin.tie(nullptr);
    ll t; cin>>t;
    while(t--) {
        ll n,m; cin>>n>>m;
        ll ans=1;
        //n!
        for(ll i=1;i<=n;i++) {
            ans *= i;
            ans%=mod;
        }
        //c n-1
        ll cn1,cm1,cc=1;
        ll ans2=1;
        //n!
        cn1=n-1,cm1=m-1;
        for(ll i=1;i<=cm1;i++) {
            ans2 *= i;
            ans2%=mod;
        }
        for(ll i=cn1;cm1>0;cm1--,cn1--) {
            cc*=cn1;
            cc%=mod;
        }
        cc/=ans2;
        cout<<(((cc%mod)*(ans%mod))%mod)<<endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

input:

2
3 2
6 3

output:

12
7200

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

4
6 5
2 2
7 5
1 1

output:

3600
2
75600
1

result:

ok 4 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

8
10 3
3 3
4 4
9 7
8 2
6 4
7 2
2 2

output:

130636800
6
24
10160640
282240
7200
30240
2

result:

ok 8 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2
3 3
1 1

output:

6
1

result:

ok 2 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

6
3 1
9 2
6 4
5 5
8 1
8 4

output:

6
2903040
7200
120
40320
1411200

result:

ok 6 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

4
7 1
6 6
3 3
3 2

output:

5040
720
6
12

result:

ok 4 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

8
2 1
10 6
7 6
1 1
7 2
1 1
2 1
7 1

output:

2
457228800
30240
1
30240
1
2
5040

result:

ok 8 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

2
6 5
8 4

output:

3600
1411200

result:

ok 2 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

6
1 1
5 1
1 1
7 1
1 1
4 1

output:

1
120
1
5040
1
24

result:

ok 6 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

4
3 3
7 2
6 5
5 5

output:

6
30240
3600
120

result:

ok 4 lines

Test #11:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

8
7 7
3 2
10 5
7 3
2 2
2 1
8 7
9 2

output:

5040
12
457228800
75600
2
2
282240
2903040

result:

ok 8 lines

Test #12:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

3
5 5
7 2
7 5

output:

120
30240
75600

result:

ok 3 lines

Test #13:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

7
6 6
10 9
6 2
3 2
6 1
5 1
8 5

output:

720
32659200
3600
12
720
120
1411200

result:

ok 7 lines

Test #14:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

5
10 8
2 1
8 3
1 1
9 5

output:

130636800
2
846720
1
25401600

result:

ok 5 lines

Test #15:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

5
4 2
10 7
5 2
5 1
7 3

output:

72
304819200
480
120
75600

result:

ok 5 lines

Test #16:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

3
5 2
3 2
10 10

output:

480
12
3628800

result:

ok 3 lines

Test #17:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

7
1 1
1 1
7 3
5 2
5 3
4 3
3 1

output:

1
1
75600
480
720
72
6

result:

ok 7 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

5
1 1
2 1
8 8
3 3
4 1

output:

1
2
40320
6
24

result:

ok 5 lines

Test #19:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

5
6 4
10 3
2 2
1 1
6 3

output:

7200
130636800
2
1
7200

result:

ok 5 lines

Test #20:

score: -100
Wrong Answer
time: 0ms
memory: 3612kb

input:

8
52 4
68 41
82 17
73 15
44 25
84 34
81 23
59 57

output:

39982437
0
0
0
0
0
0
258946120

result:

wrong answer 2nd lines differ - expected: '271239302', found: '0'