UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213864#2411. 三元组one_zero_four_zero4084ms1264kbC++11771b2024-11-13 22:49:202024-11-13 23:10:58

answer

#include<bits/stdc++.h>
#define mod 998244353LL
using namespace std;

int T;
string s;
long long ans = 0;

bool check(int l, int r){
	while (l <= r){
		if (s[l] != s[r]) return 0;
		l ++, r --;
	}
	return 1;
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("../data.in", "r", stdin);
	freopen("../data.out", "w", stdout);
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> T;
	while (T --){
		ans = 0;
		cin >> s;
		for (int i = 0; i < (int)s.size(); i ++){
			for (int m = i; m < (int)s.size(); m ++){
				if (!check(i, m)) continue;
				for (int j = m + 1; j < (int)s.size(); j ++){
					if (!check(m + 1, j)) continue;
					ans += (i + 1) * (j + 1);
					ans %= mod;
				}
			}
		}
		printf("%lld\n", ans);
	}

	return 0;
}

详细

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

Test #1:

score: 10
Accepted
time: 0ms
memory: 1264kb

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

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: 4ms
memory: 1264kb

input:

10
aaqzqvvvvzaqvazzvqqzqzavaaavvqaqqqvaqavvavvaavzvqzavaqvzvaazavqavazzvqvqazzvzvqqaqaaqqazqaqqzzzza...

output:

6230886
3556080
11774834
3833447
8206626
3621091
5300328
6484259
3025216
18509610

result:

ok 10 lines

Test #4:

score: 10
Accepted
time: 80ms
memory: 1264kb

input:

10
bsppzzcusncccbbpgguszngssnzncsnzpppbpuuczgcbucpupcubbzubsncncpbgbuzungnznsnpncpbugzcpguungzgcnbng...

output:

559443824
305794405
414279981
912202469
497470943
263140764
422669314
204178180
579056344
460822521

result:

ok 10 lines

Test #5:

score: 0
Time Limit Exceeded

input:

10
pzrpbfgjbnqhbpzohubzunqjnujfbfgazjqeaqhjgppqnogagegebuebhbeoeboouoojhbhaahjooggrozeephgqfrzrfrpjz...

output:


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:


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...

output:


result: