QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#73151#4812. Counting SequenceAcestarRE 20ms52552kbC++14567b2023-01-22 14:34:432023-01-22 14:34:44

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-22 14:34:44]
  • 评测
  • 测评结果:RE
  • 用时:20ms
  • 内存:52552kb
  • [2023-01-22 14:34:43]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int N = 3e5 + 5;
const int mod = 998244353;

int add(int x) {return x < mod ? x : x - mod;}

int s, c;
ll f[3000][3000];

int main()
{
    cin >> s >> c;
    for(int i = 0; i <= s; i++) f[i][i] = 1;
    for(int i = 1; i <= s; i++)
        for(int j = 1; j < i; j++)
            f[i][j] = (f[i][j] + f[i - j][j - 1] + f[i - j][j + 1] * c % mod) % mod;
    int ans = 0;
    for(int i = 1; i <= s; i++) ans = add(ans + f[s][i]);
    cout << ans << '\n';
    return 0;
}

详细

Test #1:

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

input:

5 3

output:

8

result:

ok 1 number(s): "8"

Test #2:

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

input:

1 0

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 19ms
memory: 52552kb

input:

2022 39

output:

273239559

result:

ok 1 number(s): "273239559"

Test #4:

score: 0
Accepted
time: 2ms
memory: 3324kb

input:

1 998244352

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

1 12345678

output:

1

result:

ok 1 number(s): "1"

Test #6:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

20 998998

output:

643731701

result:

ok 1 number(s): "643731701"

Test #7:

score: 0
Accepted
time: 2ms
memory: 3444kb

input:

23 123

output:

947753998

result:

ok 1 number(s): "947753998"

Test #8:

score: 0
Accepted
time: 2ms
memory: 3648kb

input:

50 5555

output:

745339864

result:

ok 1 number(s): "745339864"

Test #9:

score: 0
Accepted
time: 2ms
memory: 5732kb

input:

60 6666

output:

690992218

result:

ok 1 number(s): "690992218"

Test #10:

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

input:

100 50

output:

169678588

result:

ok 1 number(s): "169678588"

Test #11:

score: 0
Accepted
time: 3ms
memory: 15832kb

input:

500 88888

output:

216149701

result:

ok 1 number(s): "216149701"

Test #12:

score: 0
Accepted
time: 6ms
memory: 27952kb

input:

1000 213456

output:

270989457

result:

ok 1 number(s): "270989457"

Test #13:

score: 0
Accepted
time: 20ms
memory: 50928kb

input:

2000 119988

output:

756425375

result:

ok 1 number(s): "756425375"

Test #14:

score: -100
Runtime Error

input:

3000 998244352

output:


result: