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 ...
随机推荐
- xilinx VDMA IP核使用
VDMA实用配置说明 VDMA是通过AXI Stream协议对视频数据在PS与PL端进行搬运,开发者无需关注AXI Stream协议,在BlockDesign设计中只需要把相应信号进行连接即可. VD ...
- 宝塔webHook自动同步代码的使用
#!/bin/bashecho ""#输出当前时间date --date='0 days ago' "+%Y-%m-%d %H:%M:%S"echo " ...
- 理解css属性的继承和覆盖
首先,我们梳理一下哪些属性会被继承 文本 color 颜色,a元素除外 direction 方向 font 字体 font-family 字体系列 font-style 字体风格 font-size ...
- Codeforces 909E(Coprocessor,双队列维护)
题意:给出n个待处理的事件(0 ~n-1),再给出了n个标(0表示只能在主处理器中处理这个事件,1表示只能在副处理器中处理这个事件),处理器每次能处理多个任务.每个事件有关联,如果一个任务要在副处理器 ...
- 黑马程序员_毕向东_Java基础视频教程——java语言组成部分(随笔)
java语言组成部分 Java是一种强类型语言,所谓强类型语言就是对具体的数据进行不同的定义.对类型的划分的十分细致,对内存中分配了不同大小的内u你空间 关键字 标识符 注释 变量和常量 运算符 语句 ...
- Spring AOP实现接口验签
因项目需要与外部对接,为保证接口的安全性需要使用aop进行方法的验签; 在调用方法的时候,校验外部传入的参数进行验证, 验证通过就执行被调用的方法,验证失败返回错误信息: 不是所有的方法都需要进行验签 ...
- k8s安装部署成功
- 【雕爷学编程】MicroPython动手做(06)——零基础学MaixPy之单目摄像头
配套 OV2640摄像头:200W像素通用24P摄像头具有200万像素(1632x1232像素),其体积小.工作电压低,提供单片UXGA摄像和影像处理器的所有功能.通过SCCB总线控制,可以输出整帧. ...
- 使用CountDownLatch等待多线程
前言 CountDownLatch 允许一个或多个线程等待其他线程完成操作. 应用场景 假如有一个列表的大量数据等待处理,最后全部处理完毕后返回处理结果.普通做法就是从头遍历,一个个顺序执行,这 ...
- Hyperledger Fabric开发(二):创建网络
运行fabric-samples项目中的一个例子:first-network,创建第一个网络(Building Your First Network). 该网络共有4个peer节点,划分为2个组织(o ...