QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#321699#5577. Alchemyfrankmd2#WA 0ms3836kbC++141.2kb2024-02-05 08:13:152024-02-05 08:13:16

Judging History

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

  • [2024-02-05 08:13:16]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3836kb
  • [2024-02-05 08:13:15]
  • 提交

answer

#include <bits/stdc++.h>
#define forn(i,n) for (int i = 0; i < n; i ++)
#define forse(i,s,e) for (int i = s; i <= e; i ++)
#define forseb(i,s,e) for (int i = s; i >= e; i --)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define sz(x) (x).size()
using namespace std;

typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int, int> pi;
typedef vector<long long> vll;
typedef vector<int> vi;
const int maxl = 1e5+5;
const int inf = 1e9;
const int modn = 1e9 + 7;

int main() {

#ifndef ONLINE_JUDGE
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    string s;
    cin >> s;
    int n = sz(s);

    int ans = 0;
    forn(i, n/2) {
        if (s[i] != s[n-1-i]) {
            if (s[i+1] == s[n-i-1-1]) {
                if (s[i+2] == s[n-i-1-2]) {
                    ans += 2;
                }
                else {
                    s[i+1] ++;
                    ans ++;
                }
            }
            else {
                s[i+1] = s[n-i-1-1];
                ans ++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

詳細信息

Test #1:

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

input:

ioi

output:

0

result:

ok single line: '0'

Test #2:

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

input:

noi

output:

1

result:

ok single line: '1'

Test #3:

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

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: 3640kb

input:

vetted

output:

2

result:

ok single line: '2'

Test #6:

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

input:

aa

output:

0

result:

ok single line: '0'

Test #7:

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

input:

ic

output:

1

result:

ok single line: '1'

Test #8:

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

input:

tlffohemdcncrfrxaqsbzcoyodvbxmhqukvfpahnakexcmacqa

output:

12

result:

ok single line: '12'

Test #9:

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

input:

qrgld

output:

1

result:

ok single line: '1'

Test #10:

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

input:

ejyfprguvwrnrsrykyrotmdjuzroohvlxqhvyeukkvmshtpczyyecpzhsqvkxueqvhlxldhofrzcjdhtotykgrsdnrnvuyrphyjy

output:

34

result:

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