描述

After the Online Round contest, we believe that you have already known how to write programs in ACM contest.
For example, here‟s the analysis code of “A+B” problem.

Now after the start, you are supposed to do another easy problem.
For a string S, write a program to check whether it is a palindromic string.

Palindromice srings are strings that read the same forwards as backwards such as "abcba".

输入

There are multiple test cases.
For each case, the first line contains one integer n indicating the length of the string. And the second line contains a n-length string as described above.

1 <= n <= 100,000, the string may only contains lower case letters.

输出

For each case, print “YES” if the string is a palindromic or “NO” otherwise.

样例输入

3
aba
4
qwer

样例输出

YES
NO

回文是个好东西呐

#include <stdio.h>

int main()
{
int n,j,i;
char a[];
while(~scanf("%d",&n))
{
getchar();
for(i=;i<n;i++)
{
scanf("%c",&a[i]);
}
for(i=,j=n-;i<=(n-)/;i++,j--)
{
if(a[i]!=a[j])
break;
}
if(i>j)
printf("YES\n");
else
printf("NO\n");
}
}

TZOJ Start的更多相关文章

  1. TZOJ:3660: 家庭关系

    描述 给定若干家庭成员之间的关系,判断2个人是否属于同一家庭,即2个人之间均可以通过这些关系直接或者间接联系. 输入 输入数据有多组,每组数据的第一行为一个正整数n(1<=n<=100), ...

  2. [TZOJ] 平台训练-V1

    日常训练 训练网址:http://www.tzcoder.cn/ 1001: 整数求和 描述求两个整数之和.输入输入数据只包括两个整数A和B.输出两个整数的和.样例输入1 2样例输出3题目来源TZOJ ...

  3. TZOJ 4493: Remove Digits

    4493: Remove Digits 时间限制(普通/Java):1000MS/3000MS     内存限制:65536KByte 总提交: 329            测试通过:77 描述 G ...

  4. TZOJ 5271: 质因数的个数

    求正整数N(N>1)的质因数的个数. 相同的质因数需要重复计算.如120=2*2*2*3*5,共有5个质因数. 输入 可能有多组测试数据,每组测试数据的输入是一个正整数N,(1<N< ...

  5. TZOJ 5694 区间和II(树状数组区间加区间和)

    描述 给定n个整数,有两个操作: (1)给某个区间中的每个数增加一个值: (2)查询某个区间的和. 输入 第一行包括两个正整数n和q(1<=n, q<=100000),分别为序列的长度和操 ...

  6. TZOJ 2289 Help Bob(状压DP)

    描述 Bob loves Pizza but is always out of money. One day he reads in the newspapers that his favorite ...

  7. TZOJ 2569 Wooden Fence(凸包求周长)

    描述 Did you ever wonder what happens to your money when you deposit them to a bank account? All banks ...

  8. TZOJ 2703 Cow Digit Game(sg博弈)

    描述 Bessie is playing a number game against Farmer John, and she wants you to help her achieve victor ...

  9. TZOJ 2392 Bounding box(正n边形三点求最小矩形覆盖面积)

    描述 The Archeologists of the Current Millenium (ACM) now and then discover ancient artifacts located ...

  10. TZOJ 2519 Regetni(N个点求三角形面积为整数总数)

    描述 Background Hello Earthling. We're from the planet Regetni and need your help to make lots of mone ...

随机推荐

  1. 如何使用 Shebang Line (Python 虚拟环境)

    本文记录,如何在 Python Script 中使用 Shebang 行. Shebang Line 是什么: 也被叫做 Hashbang Line,只要是一个由,井号和叹号#!开头,并构成的字符序列 ...

  2. 关于tez-ui的"All DAGs"和"Hive Queries"页面信息为空的问题解决过程

    近段时间发现公司的HDP大数据平台的tez-ui页面不能用了,页面显示为空,导致通过hive提交的sql不能方便地查找到Yarn上对应的applicationId,只能通过beeline的屏幕输出信息 ...

  3. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十二(四十八)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  4. 二、YARN

    一.YARN 介绍 yarn 是下一代 MapReduce,即 MRv2,是在第一代 MapReduce 基础上演变而来的,主要是为了解决原始 Hadoop 扩展性较差,不支持多计算框架而提出的,通俗 ...

  5. Vue路由的hash模式与history模式的区别?

    1.首先router有两种模式:hash模式(默认).history模式(需配置mode: 'history') hash和history的区别?   hash                    ...

  6. Flask搭建个人博客网站(1)—项目规划--李渣渣(lizaza.cn)

    Flask搭建个人博客网站(1)—项目规划--李渣渣(lizaza.cn) 发布时间:2020-05-2413次浏览 前言 现在市面上又许多比较成熟的博客平台,例如:CSDN,博客园,新浪博客等!对于 ...

  7. SQL——SQL约束

    SQL约束 - 用于限制加入表的数据的类型    可以在创建表时规定约束(通过 CREATE TABLE 语句),或者在表创建之后也可以(通过 ALTER TABLE 语句).    NOT NULL ...

  8. GitHub 热点速览 Vol.21:Go 新手起手式,学就完事儿了

    作者:HelloGitHub-小鱼干 摘要:说到学习之道,方法很重要,好的学习方法能让你比他人更快地入门到精通,比如本周被 3k 多人 pick 的 learngo 项目,它收录了多个例子和练习,新手 ...

  9. JS中的基本包装类型

    想一下:为什么String类型的值可以调用某些方法和访问某些属性呢? 在基本数据类型中有3个特殊的存在:String Number Boolean 这三个基本类型都有自己对应的包装对象.包装对象,其实 ...

  10. uiautomator2通过wifi操作手机

    参考来源:https://www.cnblogs.com/c-x-a/p/11176066.html,有部分不适合当前版本的做了修改 1.手机通过USB连接电脑,先开启远程adb模式,操作如下(可以指 ...