QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#323835#5577. Alchemythanhha1210WA 0ms3852kbC++14575b2024-02-10 13:39:172024-02-10 13:39:18

Judging History

你现在查看的是最新测评结果

  • [2024-02-10 13:39:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3852kb
  • [2024-02-10 13:39:17]
  • 提交

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'