QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#287892#5817. 小学生数学题lxkk30 148ms159972kbC++14779b2023-12-21 09:15:502023-12-21 09:15:51

Judging History

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

  • [2023-12-21 09:15:51]
  • 评测
  • 测评结果:30
  • 用时:148ms
  • 内存:159972kb
  • [2023-12-21 09:15:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e7+10, MOD = 998244353;
int fac[N];

int quick_pow(int p, int q)
{
    int res = 1;
    while(q){
        if(q & 1) res = ((res % MOD) * (p % MOD)) % MOD;
        q >>= 1;
        p = ((p % MOD) * (p % MOD)) % MOD;
    }
    return res % MOD;
}

signed main()
{
    int n, k; cin >> n >> k;
    int res = 0, ans = 1;
    fac[0] = 1;
    for(int i = 1; i <= N; i ++)
    {
        ans = ((ans % MOD) * (i % MOD)) % MOD;
        fac[i] = ans;
    }
        
    for(int i = 1; i <= n; i ++)
    {
        int fz = fac[i - 1]; 
        // int fm = quick_pow(i, k); * (quick_pow(fm, MOD - 2) % MOD))
        res = (res + fz)  % MOD;
    }
    cout << res << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 10
Accepted
time: 110ms
memory: 159908kb

input:

9450395 1

output:

688545438

result:

ok single line: '688545438'

Test #2:

score: 10
Accepted
time: 112ms
memory: 159852kb

input:

8978812 1

output:

334565356

result:

ok single line: '334565356'

Test #3:

score: 10
Accepted
time: 116ms
memory: 159964kb

input:

8944235 1

output:

982802915

result:

ok single line: '982802915'

Test #4:

score: 0
Wrong Answer
time: 104ms
memory: 159760kb

input:

7081118 3

output:

856241751

result:

wrong answer 1st lines differ - expected: '599009773', found: '856241751'

Test #5:

score: 0
Wrong Answer
time: 116ms
memory: 159772kb

input:

7904241 3

output:

209857166

result:

wrong answer 1st lines differ - expected: '871243720', found: '209857166'

Test #6:

score: 0
Wrong Answer
time: 117ms
memory: 159860kb

input:

9921275 3

output:

307807180

result:

wrong answer 1st lines differ - expected: '549818101', found: '307807180'

Test #7:

score: 0
Wrong Answer
time: 125ms
memory: 159972kb

input:

17575748 14135489

output:

733367864

result:

wrong answer 1st lines differ - expected: '69236780', found: '733367864'

Test #8:

score: 0
Wrong Answer
time: 132ms
memory: 159896kb

input:

19858362 14822524

output:

856686891

result:

wrong answer 1st lines differ - expected: '239890381', found: '856686891'

Test #9:

score: 0
Wrong Answer
time: 148ms
memory: 159844kb

input:

18848696 15530895

output:

266059229

result:

wrong answer 1st lines differ - expected: '88125041', found: '266059229'

Test #10:

score: 0
Wrong Answer
time: 141ms
memory: 159732kb

input:

17787945 13890407

output:

582771673

result:

wrong answer 1st lines differ - expected: '989967864', found: '582771673'