QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#323786#5577. Alchemyleleco3248#WA 0ms3816kbC++14565b2024-02-10 13:23:332024-02-10 13:23:34

Judging History

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

  • [2024-02-10 13:23:34]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-02-10 13:23:33]
  • 提交

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) {
                cnt += 1;
                j--;
                i++;
            }
            else {
                cnt += 2;
                j-= 2;
                i+= 2;
            }
        }
    }
    cout << cnt << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3816kb

input:

ioi

output:

0

result:

ok single line: '0'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3612kb

input:

noi

output:

2

result:

wrong answer 1st lines differ - expected: '1', found: '2'