UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#187481#3347. 映射stonesx100341ms76764kbC++11414b2023-10-02 10:00:192023-10-02 12:08:23

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 5, MOD = 998244353;
long long k, a[N];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
#endif
	scanf("%lld", &k);
	a[1] = 1LL, a[2] = 2LL;
	for (int i = 3; i <= k; i++)
		a[i] = (((long long)(i - 1) * a[i - 2]) % MOD + a[i - 1]) % MOD;
	printf("%lld\n", a[k]);
	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: 1196kb

input:

4

output:

10

result:

ok single line: '10'

Test #3:

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

input:

9

output:

2620

result:

ok single line: '2620'

Test #4:

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

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

input:

351

output:

68529600

result:

ok single line: '68529600'

Test #7:

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

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: 1ms
memory: 1400kb

input:

26208

output:

299979917

result:

ok single line: '299979917'

Test #11:

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

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: 23ms
memory: 41860kb

input:

5205179

output:

190452637

result:

ok single line: '190452637'

Test #14:

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

input:

5403285

output:

170502051

result:

ok single line: '170502051'

Test #15:

score: 5
Accepted
time: 68ms
memory: 74936kb

input:

9439303

output:

345786811

result:

ok single line: '345786811'

Test #16:

score: 5
Accepted
time: 34ms
memory: 47196kb

input:

5888901

output:

652728214

result:

ok single line: '652728214'

Test #17:

score: 5
Accepted
time: 62ms
memory: 76764kb

input:

9673673

output:

894429326

result:

ok single line: '894429326'

Test #18:

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

input:

6130085

output:

607781600

result:

ok single line: '607781600'

Test #19:

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

input:

7056601

output:

440814698

result:

ok single line: '440814698'

Test #20:

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

input:

8582001

output:

681544526

result:

ok single line: '681544526'