ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#184665 | #2052. 子序列 | gispzjz | 100 | 58ms | 1400kb | C++11 | 529b | 2023-09-09 15:09:08 | 2023-09-09 15:09:09 |
answer
#include <cstdio>
#include <cstring>
const int p=998244353;
const int inv_100=828542813;
int d[30],f[120000],g[120000];
char c[120000];
int i,j,n,r,s,t;
int main()
{
scanf("%d",&n);
scanf("%s",c+1);
for (i=1;i<=n;i++)
{
scanf("%d",&g[i]);
g[i]=1LL*(100-g[i])*inv_100%p;
}
s=1;
f[0]=1;
for (i=1;i<=26;i++)
d[i]=1;
for (i=1;i<=n;i++)
{
f[i]=1LL*d[c[i]-96]*g[i]%p;
for (j=1;j<=26;j++)
if (j!=c[i]-96)
d[j]=(d[j]+f[i])%p;
s=(s+f[i])%p;
}
printf("%d",s);
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 520kb
input:
10 baabbababa 32 84 50 72 73 80 51 16 27 38
output:
931164467
result:
ok single line: '931164467'
Test #2:
score: 10
Accepted
time: 0ms
memory: 520kb
input:
10 aabbbabaaa 79 10 1 51 54 84 75 61 5 20
output:
199251909
result:
ok single line: '199251909'
Test #3:
score: 10
Accepted
time: 0ms
memory: 516kb
input:
10 baabaabbaa 78 49 45 16 16 79 21 99 61 49
output:
522228342
result:
ok single line: '522228342'
Test #4:
score: 10
Accepted
time: 0ms
memory: 532kb
input:
1000 dabdbedccdebcdbbebdcaeedebdbccdaabebdecbeebbebedecebacdcabdbeaebcbdeceaaebddceadbbaaebeedccedea...
output:
825347577
result:
ok single line: '825347577'
Test #5:
score: 10
Accepted
time: 0ms
memory: 532kb
input:
1000 dababaebbeaedccabebabcecebebaeebeedbebbddbebccceebbdbccbedeecddabebcedadbecbadcedebbccaaeadccaa...
output:
298152289
result:
ok single line: '298152289'
Test #6:
score: 10
Accepted
time: 14ms
memory: 1400kb
input:
100000 bbgejihfhafdeacedbbgiaafecgidaeiggbbjfhiaaheaijghhbifcjcdhadcdedjdejijbeihgfjafeiaehhfigjgaig...
output:
614248473
result:
ok single line: '614248473'
Test #7:
score: 10
Accepted
time: 14ms
memory: 1400kb
input:
100000 ieefgijddfhhbgfedegdddaijafgicijgcahijggbehbbihdhfeiacjfehjjeeebeaheiadhddeafcbcehahbieeihdag...
output:
299542715
result:
ok single line: '299542715'
Test #8:
score: 10
Accepted
time: 14ms
memory: 1400kb
input:
100000 ebfabaffebgjjajbacjdjhhgbgehagjhihbjidhdcgjcbghegbabjbecjgjfcjjeijbfjdddfjeajjffabijfaggdjhcf...
output:
689835121
result:
ok single line: '689835121'
Test #9:
score: 10
Accepted
time: 7ms
memory: 1400kb
input:
100000 jifjcebdgjjjfcafdceiehfgfciechchcebbjijbdcbhhejdcieebbhfabbjghhjgfaafgbbgbcicjgcfdfbjicagcffg...
output:
448080023
result:
ok single line: '448080023'
Test #10:
score: 10
Accepted
time: 9ms
memory: 1396kb
input:
100000 agjjjcibcbcaajegcihcidbbagjgjdajajffgjjihjfjgijadgjjifcfciihchdiefihbidihcheecccbjdcagecdjhif...
output:
245353070
result:
ok single line: '245353070'