QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#333518#5577. Alchemyjoelgun14#WA 1ms3832kbC++141.5kb2024-02-20 04:28:372024-02-20 04:28:38

Judging History

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

  • [2024-02-20 04:28:38]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3832kb
  • [2024-02-20 04:28:37]
  • 提交

answer

#include <bits/stdc++.h>
#define fi first
#define se second
#define bit(x) (1LL << (x))
#define getbit(x, i) (((x) >> (i)) & 1)
#define ALL(x) (x.begin(), x.end())
using namespace std;

template <typename T1, typename T2> bool maxi(T1 &a, T2 b) {
    if (a < b) {a = b; return true;} return false;
}

template <typename T1, typename T2> bool mini(T1 &a, T2 b) {
    if (a > b) {a = b; return true;} return false;
}

const int N = 2e5 + 5;
const int oo = 1e9;
const long long ooo = 1e18;

int main() {
    string s;
    cin >> s;
    if(s.size() == 1) {
        cout << 0 << endl;
    }
    else if(s.size() & 1) {
        int res = 0;
        for(int i = 0; i < s.size() / 2; ++i) {
            if(s[i] != s[s.size() - i - 1])
                ++res;
        }
        //cout << s[s.size() / 2  - 1] << " " << s[s.size() - s.size() / 2] << endl;
        if(s[s.size() / 2 - 1] != s[s.size() - s.size() / 2]) {
            cout << res << endl;
        }
        else {
            if(res & 1) {
                ++res;
            }
            cout << res << endl;
        }
    }
    else {
        int res = 0;
        for(int i = 0; i < s.size() / 2; ++i) {
            if(s[i] != s[s.size() - i - 1]) {
                ++res;
            }
        }
        if(s[s.size() / 2] != s[s.size() / 2 - 1]) {
            cout << res << endl;
        }
        else {
            if(res & 1)
                ++res;
            cout << res << endl;
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3832kb

input:

ioi

output:

0

result:

ok single line: '0'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

noi

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

ctsc

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

fool

output:

2

result:

ok single line: '2'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

vetted

output:

2

result:

ok single line: '2'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

aa

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

ic

output:

1

result:

ok single line: '1'

Test #8:

score: -100
Wrong Answer
time: 1ms
memory: 3640kb

input:

tlffohemdcncrfrxaqsbzcoyodvbxmhqukvfpahnakexcmacqa

output:

24

result:

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