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

因此,代码分为:

>>> 读入
>>> 删除后缀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. C++总结(1)keywords to the class

    目录 Chapter 1.关于类的关键字 1. class,struct与union 2.private,public与protected 3.friend 4.virtual 5.const 6.i ...

  2. 问题:做EsayUI分页报错 $(...).pagination is not a function之后我把<jsp:include page="top.jsp"/>去掉就好了,有大神知道为什么吗?另外分页按键放在那里好些,我放到form表单下,就开始显示,点一下后就没有了

    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...

  3. 张孝祥java高新技术 --- jkd1.5 新特性 -- 精华总结

    1. 抽象方法的使用 如果一个方法中大量出现if语句, 那么, 就应该考虑使用抽象来处理. 如下例: package com.lxl; public class Weekend { //周日 publ ...

  4. PHP 向数组头部插入数据

    PHP 向数组头部插入数据 函数: array_unshift() 示例: $s = array('a' => 0, 'b' => 3); array_unshift($s, '5'); ...

  5. pat 1149 Dangerous Goods Packaging(25 分)

    1149 Dangerous Goods Packaging(25 分) When shipping goods with containers, we have to be careful not ...

  6. Python3.7.1学习(三)求两个list的差集、并集与交集

    在python3.7.1对列表的处理中,会经常使用到Python求两个list的差集.交集与并集的方法. 下面就以实例形式对此加以分析. # 求两个list的差集.并集与交集# 一.两个list差集# ...

  7. 领扣(LeetCode)二叉树的右视图 个人题解

    给定一棵二叉树,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值. 示例: 输入: [1,2,3,null,5,null,4] 输出: [1, 3, 4] 解释: 1 < ...

  8. bash6——循环

    for fruit in apple orange pear #写死 do each ${fruit}s done fruits="apple orange pear" #输入变量 ...

  9. 图文详解基于角色的权限控制模型RBAC

    我们开发一个系统,必然面临权限控制的问题,即不同的用户具有不同的访问.操作.数据权限.形成理论的权限控制模型有:自主访问控制(DAC: Discretionary Access Control).强制 ...

  10. 阿里云ECS搭建kubernetes1.11

    环境信息 说明 1.使用kubeadm安装集群 虚拟机信息 hostname memory cpu disk role node1.com 4G 2C vda20G vdb20G master nod ...