QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325951 | #5577. Alchemy | anpans# | WA | 1ms | 3680kb | C++14 | 835b | 2024-02-12 05:25:26 | 2024-02-12 05:25:26 |
Judging History
answer
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>
using namespace std;
int l, t;
string s;
int main() {
cin >> s;
l = s.length();
t = 0;
for (int i = 0; i < l / 2; i++) {
if (s[i] == s[l-i-1]) {
continue;
} else if (s[i] != s[l-i-1] && s[i+1] != s[l-i-2]) {
t++;
s[i] = s[l-i-1];
s[i+1] = s[l-i-2];
} else if (s[i] != s[l-i-1] && s[i+1] == s[l-i-2] && s[i+2] != s[l-i-3]) {
if (l-i-1 == i+2) t++;
else t += 2;
s[i] = s[l-i-1];
s[i+2] = s[l-i-3];
} else if (s[i] != s[l-i-1] && s[i+1] == s[l-i-2] && s[i+2] == s[l-i-3]) {
t += 2;
s[i] = s[l-i-1];
}
}
cout << t << '\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3568kb
input:
ioi
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
noi
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
ctsc
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
fool
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
vetted
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
aa
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
ic
output:
1
result:
ok single line: '1'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
tlffohemdcncrfrxaqsbzcoyodvbxmhqukvfpahnakexcmacqa
output:
12
result:
ok single line: '12'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
qrgld
output:
1
result:
ok single line: '1'
Test #10:
score: -100
Wrong Answer
time: 1ms
memory: 3620kb
input:
ejyfprguvwrnrsrykyrotmdjuzroohvlxqhvyeukkvmshtpczyyecpzhsqvkxueqvhlxldhofrzcjdhtotykgrsdnrnvuyrphyjy
output:
34
result:
wrong answer 1st lines differ - expected: '26', found: '34'