QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#323853 | #5577. Alchemy | thanhha1210 | WA | 1ms | 3744kb | C++14 | 731b | 2024-02-10 13:47:42 | 2024-02-10 13:47:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
//while (true) {
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 if (s[i + 1] != s[j - 1]) {
cnt++;
j-= 2;
i+= 2;
}
else {
cnt += 2;
j-= 2;
i+= 2;
}
}
}
cout << cnt << endl;
//}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3568kb
input:
ioi
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
noi
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
ctsc
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
fool
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
vetted
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
aa
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
ic
output:
1
result:
ok single line: '1'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
tlffohemdcncrfrxaqsbzcoyodvbxmhqukvfpahnakexcmacqa
output:
12
result:
ok single line: '12'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
qrgld
output:
1
result:
ok single line: '1'
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 3512kb
input:
ejyfprguvwrnrsrykyrotmdjuzroohvlxqhvyeukkvmshtpczyyecpzhsqvkxueqvhlxldhofrzcjdhtotykgrsdnrnvuyrphyjy
output:
34
result:
wrong answer 1st lines differ - expected: '26', found: '34'