此题本质上是:求一个数去掉后缀零后是否是回文串

因此,代码分为:

>>> 读入
>>> 删除后缀0
>>> 判断回文
>>> 转为数组存储
>>> 依次比较开头和结尾是否相同(头指针后移,尾指针前移)
>>> 输出结果

所以,我们有了:

#include <?????.?>		//杜绝抄袭!

??? main()				//杜绝抄袭!
{
int n; //读入
scanf("%d", &n); //删除后缀0
while (n % 10 == 0) n /= 10; int a[10], len = 0; //a存储数组形式的n
bool huiwen = true; //删除后缀0的n是否是回文 //转为数组存储
while (n != 0) a[m++] = n % 10, n /= 10; //依次比较开头和结尾是否相同(头指针后移,尾指针前移)
for (int i = 0, j = m - 1; i <= j; i++, j--)
if (a[i] != a[j]) huiwen = false; //输出
if (huiwen)
printf("YES");
else
printf("NO");
return 0;
}
avoiding plagiarism! //杜绝抄袭!

Codeforces 题解 CF863A 【Quasi-palindrome】的更多相关文章

  1. Codeforces Gym 100570 E. Palindrome Query Manacher

    E. Palindrome QueryTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100570/pro ...

  2. Codeforces 798A - Mike and palindrome

    A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  3. 每日一题:codeforces题解

    题目 B. Peculiar Movie Preferences time limit per test 2 seconds memory limit per test 512 megabytes i ...

  4. Codeforces Round #300 Quasi Binary(DP)

    Quasi Binary time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  5. Codeforces 538 B. Quasi Binary

    B. Quasi Binary   time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  6. leetcode题解:Valid Palindrome(判断回文)

    题目: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ig ...

  7. 【Codeforces 600C】Make Palindrome

    [链接] 我是链接,点我呀:) [题意] 题意 [题解] 计算出来每个字母出现的次数. 把字典序大的奇数出现次数的字母换成字典序小的奇数出现次数的字母贪心即可. 注意只有一个字母的情况 然后贪心地把字 ...

  8. NEKO's Maze Game - Codeforces 题解

    题目 NEKO#ΦωΦ has just got a new maze game on her PC! The game's main puzzle is a maze, in the forms o ...

  9. Leetcode题解之Valid Palindrome II

    1.题目描述 2.问题分析 使用两个下标,检测下标对应的字符是否相等,若不相等,则考察子串. 3.代码 bool validPalindrome(string s) { , j = s.size()- ...

随机推荐

  1. Genymotion模拟器安装搜狗输入法

    Genymotion模拟器默认没有中文输入法,如果在一些调试中涉及到需要输入中文则必须需要安装中文输入法. 这里以搜狗输入法为例. 这里需要注意一下几点就行: 百度下载一个搜狗输入法,需要特别注意的是 ...

  2. Weblogic 12c 的 Apache HTTP Server 整合插件(Plug-In)下载地址

    资料来源:到哪里下载Weblogic 12c 的Plug-In 为 Apache HTTP Server 摘录如下: 最新的Weblogic 12c不再为 Apache HTTP Server提供缺省 ...

  3. c#属性(Property)

    属性(Property)是类(class).结构(structure)和接口(interface)的命名(named)成员.类或结构中的成员变量或方法称为 域(Field).属性(Property)是 ...

  4. Graphviz 画图的一些总结

    Graphviz Graphviz 是一个自动排版的作图软件,可以生成 png pdf 等格式. 一切以官方文档为准,博客只是参考.这里做一个自己学习的记录. dot 语法介绍 部分图形属性介绍 示例 ...

  5. nyoj 8-一种排序 (贪心)

    8-一种排序 内存限制:64MB 时间限制:3000ms Special Judge: No accepted:9 submit:18 题目描述: 现在有很多长方形,每一个长方形都有一个编号,这个编号 ...

  6. nyoj 38-布线问题(prim, sort)

    38-布线问题 内存限制:64MB 时间限制:1000ms Special Judge: No accepted:5 submit:11 题目描述: 南阳理工学院要进行用电线路改造,现在校长要求设计师 ...

  7. nyoj 206-矩形的个数 (a*b*(a+1)*(b+1)/4)

    206-矩形的个数 内存限制:64MB 时间限制:1000ms 特判: No 通过数:16 提交数:37 难度:1 题目描述: 在一个3*2的矩形中,可以找到6个1*1的矩形,4个2*1的矩形3个1* ...

  8. RevitAPI 隐藏UI读取Revit文件

    1.1. 新建一个控制台项目 1.2. 添加Revit API引用 我们找到revit安装目录下的这两个DLL添加到项目引用中 RevitNET.dll RevitAPI.dll 修改属性:复制本地: ...

  9. Filebeat自定义索引 && 多output过滤

    一.目标 1)实现自定义索引 2)不同的input输出到各自对应的索引,nginx的日志输出到index-nginx的索引,zabbix的日志输出到index-zabbix,app的日志输出到inde ...

  10. 【原】android【手机】屏幕适配解决方案,完美适配适配hdpi,xhdpi,xxhdpi的做法。

    1.先说要怎么做,后面在慢慢讲解: 2.现在来讲解为什么要放这三套: 这三套其实按内容来说就两种,为什么这两种可以适配hdpi,xhdpi,xxhdpi呢? 那么两种类型的dimens就可以了,为什么 ...