HDU2029(回文串水题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2029


解题思路:

朴素判断回文串。


完整代码:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

#pragma comment(linker, "/STACK:102400000,102400000")

typedef long long LL;
typedef double DB;
typedef unsigned uint;
typedef unsigned long long uLL;

/** Constant List .. **/ //{

const int MOD = int(1e9)+7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const DB EPS = 1e-9;
const DB OO = 1e20;
const DB PI = acos(-1.0); //M_PI;
string str;
int main()
{
    #ifdef DoubleQ
    freopen("in.txt","r",stdin);
    #endif
    int T;
    cin >> T;
    while(T--)
    {
        cin >> str;
        int len = str.length();
        int flag = 0;
        for(int i = 0  , j = len - 1 ; i < j ; i ++ , j --)
        {
            if(str[i] != str[j])
            {
                flag = 1;
                break;
            }
        }
        if(flag)
            cout << "no" << endl;
        else
            cout << "yes" << endl;
        str = "";
    }
}


你可能感兴趣的:(HDU,水题)