UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#187527#3347. 映射xzx001100360ms76760kbC++11383b2023-10-02 10:21:162023-10-02 12:11:13

answer

#include <bits/stdc++.h>
#define MOD 998244353
using namespace std;
long long ans[10000010];
long long bemod(long long x) {
	return x % MOD;
}
int main() {
	long long n, i;
	ans[1] = 1, ans[2] = 2;
	ans[3] = 4, ans[4] = 10;
	scanf("%lld", &n);
	for (i = 5; i <= n; i++)
		ans[i] = bemod(bemod(ans[i - 2] * (i - 1)) + ans[i - 1]);
	printf("%lld", ans[n]);
	return 0;
}

详细

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

Test #1:

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

input:

7

output:

232

result:

ok single line: '232'

Test #2:

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

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: 1188kb

input:

7

output:

232

result:

ok single line: '232'

Test #5:

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

input:

199

output:

946214672

result:

ok single line: '946214672'

Test #6:

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

input:

351

output:

68529600

result:

ok single line: '68529600'

Test #7:

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

input:

511

output:

903273780

result:

ok single line: '903273780'

Test #8:

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

input:

669

output:

859250862

result:

ok single line: '859250862'

Test #9:

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

input:

21429

output:

24969958

result:

ok single line: '24969958'

Test #10:

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

input:

26208

output:

299979917

result:

ok single line: '299979917'

Test #11:

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

input:

38557

output:

507040672

result:

ok single line: '507040672'

Test #12:

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

input:

95011

output:

523339279

result:

ok single line: '523339279'

Test #13:

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

input:

5205179

output:

190452637

result:

ok single line: '190452637'

Test #14:

score: 5
Accepted
time: 40ms
memory: 43404kb

input:

5403285

output:

170502051

result:

ok single line: '170502051'

Test #15:

score: 5
Accepted
time: 47ms
memory: 74932kb

input:

9439303

output:

345786811

result:

ok single line: '345786811'

Test #16:

score: 5
Accepted
time: 32ms
memory: 47192kb

input:

5888901

output:

652728214

result:

ok single line: '652728214'

Test #17:

score: 5
Accepted
time: 63ms
memory: 76760kb

input:

9673673

output:

894429326

result:

ok single line: '894429326'

Test #18:

score: 5
Accepted
time: 42ms
memory: 49080kb

input:

6130085

output:

607781600

result:

ok single line: '607781600'

Test #19:

score: 5
Accepted
time: 44ms
memory: 56316kb

input:

7056601

output:

440814698

result:

ok single line: '440814698'

Test #20:

score: 5
Accepted
time: 51ms
memory: 68232kb

input:

8582001

output:

681544526

result:

ok single line: '681544526'