TZOJ Start
描述
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的更多相关文章
- TZOJ:3660: 家庭关系
描述 给定若干家庭成员之间的关系,判断2个人是否属于同一家庭,即2个人之间均可以通过这些关系直接或者间接联系. 输入 输入数据有多组,每组数据的第一行为一个正整数n(1<=n<=100), ...
- [TZOJ] 平台训练-V1
日常训练 训练网址:http://www.tzcoder.cn/ 1001: 整数求和 描述求两个整数之和.输入输入数据只包括两个整数A和B.输出两个整数的和.样例输入1 2样例输出3题目来源TZOJ ...
- TZOJ 4493: Remove Digits
4493: Remove Digits 时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte 总提交: 329 测试通过:77 描述 G ...
- TZOJ 5271: 质因数的个数
求正整数N(N>1)的质因数的个数. 相同的质因数需要重复计算.如120=2*2*2*3*5,共有5个质因数. 输入 可能有多组测试数据,每组测试数据的输入是一个正整数N,(1<N< ...
- TZOJ 5694 区间和II(树状数组区间加区间和)
描述 给定n个整数,有两个操作: (1)给某个区间中的每个数增加一个值: (2)查询某个区间的和. 输入 第一行包括两个正整数n和q(1<=n, q<=100000),分别为序列的长度和操 ...
- TZOJ 2289 Help Bob(状压DP)
描述 Bob loves Pizza but is always out of money. One day he reads in the newspapers that his favorite ...
- TZOJ 2569 Wooden Fence(凸包求周长)
描述 Did you ever wonder what happens to your money when you deposit them to a bank account? All banks ...
- TZOJ 2703 Cow Digit Game(sg博弈)
描述 Bessie is playing a number game against Farmer John, and she wants you to help her achieve victor ...
- TZOJ 2392 Bounding box(正n边形三点求最小矩形覆盖面积)
描述 The Archeologists of the Current Millenium (ACM) now and then discover ancient artifacts located ...
- TZOJ 2519 Regetni(N个点求三角形面积为整数总数)
描述 Background Hello Earthling. We're from the planet Regetni and need your help to make lots of mone ...
随机推荐
- ipad4密码忘记锁定了如何破解
ipad4更新后被要求输入密码,但很长一段时间后忘记了,一直想不起来,也没有忘记密码的选项,以下是简单的破解方法. 注意:没有备份的资料是要被清空的 一.windows10系统,安装iTunes安装 ...
- html中require.config 缓存问题
在html中,require的官方基本用法如下: <!DOCTYPE html> <html> <head> <title>My Sample Proj ...
- [tgpl]go匿名函数
[tgpl]go匿名函数 0. 定义 匿名函数顾名思义是没有名字的函数, Named functions can be declared only at the package level, but ...
- iptables做nat网络地址转换
iptables做nat网络地址转换. 0. 权威文档 http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO-6.html e文好的直接跳过本文 ...
- OGG应用进程abend报错无法insert虚拟列
环境11.2.0.4 linux6.9 RAC2节点,ogg版本Version 12.2.0.1.160823 OGGCORE_OGGADP.12.2.0.1.0_PLATFORMS_161019.1 ...
- SWPU邮件登录界面的仿写(第二次作业)
(一).检查并下载网页元素 在需仿写的页面按F12,点击element,寻找需要的图片元素. (二). 分析网页的布局 查看网页源代码. (三).开始仿写 由于我们的目标是仿写网页,所以可以直接复制网 ...
- 关于php中数据提交到当前页面action的问题
关于php中数据提交到当前页面action的问题 2011-06-21 17:45杨超★杰伦 | 分类:PHP | 浏览695次 php中数据提交到当前页面,有人action=“<?php ec ...
- PHP SQL预处理
php预处理查询 $query='insert into p1(info) values(?)'; $query2='select info from p1 where id=?'; $country ...
- COLA的扩展性使用和源码研究
cola扩展点使用和设计初探 封装变化,可灵活应对程序的需求变化. 扩展点使用 步骤: 定义扩展点接口,类型可以是校验器,转换器,实体: 必须以ExtPt结尾,表示一个扩展点. 比如,我定义一个云枢的 ...
- 题解 P4071 【[SDOI2016]排列计数】 (费马小定理求组合数 + 错排问题)
luogu题目传送门! luogu博客通道! 这题要用到错排,先理解一下什么是错排: 问题:有一个数集A,里面有n个元素 a[i].求,如果将其打乱,有多少种方法使得所有第原来的i个数a[i]不在原来 ...