描述

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. spark机器学习从0到1聚类算法 (十)

      一.概念 1.1.定义 按照某一个特定的标准(比如距离),把一个数据集分割成不同的类或簇,使得同一个簇内的数据对象的相似性尽可能大,同时不再同一个簇内的数据对象的差异性也尽可能的大. 聚类属于典型 ...

  2. mysql小白系列_08 zabbix添加自定义监控项items和触发器

    监控mysql存活 1.配置agent自定义参数 vi /usr/local/zabbix/etc/zabbix_agentd.conf Include=/usr/local/zabbix/etc/z ...

  3. BZOJ1059 二分匹配

    1059: [ZJOI2007]矩阵游戏 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 4810  Solved: 2297[Submit][Stat ...

  4. UVa 11529

    题目大意:见刘汝佳<算法竞赛入门经典——训练指南>P173 解题思路: 先求出对于每一个点,有多少个三角形包含它,把各个点得到的数值加起来的总和除以 C[n][3] 即可得出答案.对于每一 ...

  5. C语言基础知识(四)——位操作

    一.进制基础知识 1.通常,1字节(Byte)包含8位(bit).C语言用字节表示储存系统字符集所需的大小. 2.对于一个1字节8位的二进制数,最右边(第0位)是最低阶位,最左边(第1位)是最高阶位, ...

  6. 【NLP】老司机带你入门自然语言处理

    自然语言处理是一门用于理解人类语言.情感和思想的技术,被称为是人工智能皇冠上的明珠. 随着深度学习发展,自然语言处理技术近年来发展迅速,在技术上表现为BERT.GPT等表现极佳的模型:在应用中表现为c ...

  7. 加密通信软件Signal 2.92版本编译安装折腾手记(Ubuntu 18.04)

    加密通信软件Signal 2.92版本编译安装折腾手记(Ubuntu 18.04) 前言 加密通信软件Signal是开源的,安全性很高,号称斯诺登也推荐大家使用.既然这么好,那必然会有不少人去尝试复制 ...

  8. vue 实例化使用模板

    var vm = new Vue({ el:"", data:{ }, methods:{ } })

  9. Channels集成到Django消息实时推送

    channel架构图 InterFace Server:负责对协议进行解析,将不同的协议分发到不同的Channel Channel Layer:频道层,可以是一个FIFO队列,通常使用Redis Dj ...

  10. JavaScript 简版-菜鸟中的菜鸟2

    JavaScript 输出 JavaScript 没有任何打印或者输出的函数. JavaScript 显示数据 JavaScript 可以通过不同的方式来输出数据: 使用 window.alert() ...