UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#187535#3347. 映射JNE100249ms1192kbC++11378b2023-10-02 10:25:122023-10-02 12:12:23

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 998244353
int k,tmp1=1,tmp2=2,ans;
signed main(){
    scanf("%lld",&k);
    if(k==1||k==2){
        printf("%lld",k);
        return 0;
    }
    for(int i=3;i<=k;i++){
        ans=(tmp1*(i-1)%MOD+tmp2)%MOD;
        tmp1=tmp2,tmp2=ans;
    }
    printf("%lld",ans);
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 5
Accepted
time: 0ms
memory: 1192kb

input:

7

output:

232

result:

ok single line: '232'

Test #2:

score: 5
Accepted
time: 0ms
memory: 1188kb

input:

4

output:

10

result:

ok single line: '10'

Test #3:

score: 5
Accepted
time: 0ms
memory: 1188kb

input:

9

output:

2620

result:

ok single line: '2620'

Test #4:

score: 5
Accepted
time: 0ms
memory: 1192kb

input:

7

output:

232

result:

ok single line: '232'

Test #5:

score: 5
Accepted
time: 0ms
memory: 1192kb

input:

199

output:

946214672

result:

ok single line: '946214672'

Test #6:

score: 5
Accepted
time: 0ms
memory: 1192kb

input:

351

output:

68529600

result:

ok single line: '68529600'

Test #7:

score: 5
Accepted
time: 0ms
memory: 1188kb

input:

511

output:

903273780

result:

ok single line: '903273780'

Test #8:

score: 5
Accepted
time: 0ms
memory: 1188kb

input:

669

output:

859250862

result:

ok single line: '859250862'

Test #9:

score: 5
Accepted
time: 0ms
memory: 1188kb

input:

21429

output:

24969958

result:

ok single line: '24969958'

Test #10:

score: 5
Accepted
time: 0ms
memory: 1192kb

input:

26208

output:

299979917

result:

ok single line: '299979917'

Test #11:

score: 5
Accepted
time: 0ms
memory: 1192kb

input:

38557

output:

507040672

result:

ok single line: '507040672'

Test #12:

score: 5
Accepted
time: 0ms
memory: 1192kb

input:

95011

output:

523339279

result:

ok single line: '523339279'

Test #13:

score: 5
Accepted
time: 23ms
memory: 1188kb

input:

5205179

output:

190452637

result:

ok single line: '190452637'

Test #14:

score: 5
Accepted
time: 20ms
memory: 1188kb

input:

5403285

output:

170502051

result:

ok single line: '170502051'

Test #15:

score: 5
Accepted
time: 41ms
memory: 1188kb

input:

9439303

output:

345786811

result:

ok single line: '345786811'

Test #16:

score: 5
Accepted
time: 26ms
memory: 1188kb

input:

5888901

output:

652728214

result:

ok single line: '652728214'

Test #17:

score: 5
Accepted
time: 43ms
memory: 1192kb

input:

9673673

output:

894429326

result:

ok single line: '894429326'

Test #18:

score: 5
Accepted
time: 27ms
memory: 1192kb

input:

6130085

output:

607781600

result:

ok single line: '607781600'

Test #19:

score: 5
Accepted
time: 31ms
memory: 1192kb

input:

7056601

output:

440814698

result:

ok single line: '440814698'

Test #20:

score: 5
Accepted
time: 38ms
memory: 1192kb

input:

8582001

output:

681544526

result:

ok single line: '681544526'