QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#323835 | #5577. Alchemy | thanhha1210 | WA | 0ms | 3852kb | C++14 | 575b | 2024-02-10 13:39:17 | 2024-02-10 13:39:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int len = s.length();
int cnt = 0;
int i = 0, j = len - 1;
while (i < j) {
if (s[i] == s[j]) {
i++;
j--;
}
else {
if (j == i + 1 || j == i + 2) {
cnt += 1;
j--;
i++;
}
else {
cnt += 2;
j-= 2;
i+= 2;
}
}
}
cout << cnt << endl;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
input:
ioi
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
noi
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
ctsc
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
fool
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
vetted
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
aa
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
ic
output:
1
result:
ok single line: '1'
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3564kb
input:
tlffohemdcncrfrxaqsbzcoyodvbxmhqukvfpahnakexcmacqa
output:
24
result:
wrong answer 1st lines differ - expected: '12', found: '24'