ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213845 | #2411. 三元组 | huangyuhe | 30 | 27ms | 1260kb | C++11 | 593b | 2024-11-13 21:53:12 | 2024-11-13 23:09:13 |
answer
#include <bits/stdc++.h>
#define C__ const
using namespace std;
C__ int MOD = 998244353;
bool check(int l, int r, C__ string& s) {
for (int i = l, j = r; i < j; i++, j--)
if (s[i] != s[j]) return false;
return true;
}
int main() {
int T; cin >> T;
while (T--) {
string s; cin >> s;
int n = s.size(); s = "#" + s;
int ans = 0;
for (int l = 1; l <= n; l++) {
for (int r = l + 1; r <= n; r++)
for (int m = l; m < r; m++)
if (check(l, m, s) && check(m + 1, r, s))
(ans += l * r % MOD) %= MOD;
}
cout << ans % MOD << "\n";
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1252kb
input:
10 kyynjrttqngurtcvcjnnuqmstrntnpghrqqqp lqfnqzykyzzynqnqyywzzwwfnyzlwykznyfhyknfnk fuhjuhhuhuqjuuqu...
output:
27169 35530 31188 37732 65217 28457 133147 22985 43141 10759
result:
ok 10 lines
Test #2:
score: 10
Accepted
time: 0ms
memory: 1256kb
input:
10 eedleeeldeededlllleldleeeleleddleellele kllrnnjqjniqqknjmlfcirjyrycfrkyqqjrky uksfueafjuarusziepe...
output:
66808 20895 14900 37820 39914 38054 29364 37426 38775 29747
result:
ok 10 lines
Test #3:
score: 10
Accepted
time: 27ms
memory: 1260kb
input:
10 aaqzqvvvvzaqvazzvqqzqzavaaavvqaqqqvaqavvavvaavzvqzavaqvzvaazavqavazzvqvqazzvzvqqaqaaqqazqaqqzzzza...
output:
6230886 3556080 11774834 3833447 8206626 3621091 5300328 6484259 3025216 18509610
result:
ok 10 lines
Test #4:
score: 0
Time Limit Exceeded
input:
10 bsppzzcusncccbbpgguszngssnzncsnzpppbpuuczgcbucpupcubbzubsncncpbgbuzungnznsnpncpbugzcpguungzgcnbng...
output:
559443824 305794405 414279981
result:
Test #5:
score: 0
Time Limit Exceeded
input:
10 pzrpbfgjbnqhbpzohubzunqjnujfbfgazjqeaqhjgppqnogagegebuebhbeoeboouoojhbhaahjooggrozeephgqfrzrfrpjz...
output:
442803205 483459867
result:
Test #6:
score: 0
Time Limit Exceeded
input:
100000 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
output:
341665830 471661 1999742 543480 459540 202296822 191363172 1241848 713235 369157 575809 170913820 68...
result:
Test #7:
score: 0
Time Limit Exceeded
input:
10000 iqtuiwnrdznudrwdznuwoyhzhhmiqytqhdqjuhihyuyrmwqurmdzdwiidomqrihqrjzyjwytjhznuwuhiojnhiduhytjir...
output:
452745570 395658802 415729637 581286624
result:
Test #8:
score: 0
Time Limit Exceeded
input:
1000 sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...
output:
result:
Test #9:
score: 0
Time Limit Exceeded
input:
100 yuuxiorshssxoiyxrsxyyyuxsuyuhsruhxisoyiuuixhrsxuxyyxxosihhyisxxohoyiiurxhixrruryiihxhsxhxuhoroou...
output:
result:
Test #10:
score: 0
Time Limit Exceeded
input:
10 qvvvvqqgqgvvvgqvgqvqqwqgwqvqggvgqqqgqvwwggwwqqqqqwvwqggqvgqqvvvvvwqvqvvgvvqgvwqggwqqvvwwvvgwwwgqg...