이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while ( t-- ) {
string s;
cin >> s;
int l = 0, r = s.size() - 1, cuv = 0;
while ( l <= r ) {
string a = "", b = "";
int i = 1;
while ( i <= (r - l + 1) / 2 ) {
a += s[l + i - 1];
b += s[r - i + 1];
reverse( b.begin(), b.end());
if ( a == b )
break;
reverse( b.begin(), b.end());
i++;
}
if ( i <= (r - l + 1) / 2 ) {
l += i;
r -= i;
cuv += 2;
} else {
cuv++;
break;
}
}
cout << cuv << "\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |