[Offer收割]编程练习赛54 register

Ended

Participants:154

Verdict:Accepted
Score:100 / 100
Submitted:2018-04-08 14:29:18

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin >> str;
    int len = str.length();
    int i = 0, j =  str.length() - 1;
    int res = -1;
    while(i < j)
    {
        if(str[i] != str[j])
            {
                res = i;
                break;
            }
            ++i;
            --j;
    }
        if(res == -1)
        {
            if(res  & 0x1)
            {
                res = str.length()/2;
                
            }   
            else
                res = str.length()/2-1;
        }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX