[Codeforces 863A]Quasi-palindrome
Description
Let quasi-palindromic number be such number that adding some leading zeros (possible none) to it produces a palindromic string.
String t is called a palindrome, if it reads the same from left to right and from right to left.
For example, numbers 131 and 2010200 are quasi-palindromic, they can be transformed to strings "131" and "002010200", respectively, which are palindromes.
You are given some integer number x. Check if it's a quasi-palindromic number.
Input
Output
Print "YES" if number x is quasi-palindromic. Otherwise, print "NO" (without quotes).
Sample Input
131
Sample Output
YES
题解
给你一个数,判断它是不是准回文数(补全前导零使其成为回文数)
I think there is no need to tell you how to solve this problem...
//It is made by Awson on 2017.9.30
#include <set>
#include <map>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define Min(a, b) ((a) < (b) ? (a) : (b))
#define Max(a, b) ((a) > (b) ? (a) : (b))
using namespace std;
void read(int &x) {
;
); ch = getchar());
; isdigit(ch); x = (x<<)+(x<<)+ch-, ch = getchar());
x *= -*flag;
}
];
void work() {
read(x);
;
while (x) {
a[++top] = x%;
x /= ;
}
;
; i <= top && a[i] == ; i++) cnt++;
; i <= cnt; i++) top++;
;
; i <= top/; i++)
]) {
flag = ;
break;
}
printf(flag ? "NO\n" : "YES\n");
}
int main() {
work();
;
}
[Codeforces 863A]Quasi-palindrome的更多相关文章
- CodeForces - 600C Make Palindrome 贪心
A string is called palindrome if it reads the same from left to right and from right to left. For ex ...
- Codeforces Round 486C - Palindrome Transformation 贪心
C. Palindrome Transformation time limit per test 1 second memory limit per test 256 megabytes input ...
- Codeforces Gym100952 C. Palindrome Again !!-回文字符串 (2015 HIAST Collegiate Programming Contest)
C. Palindrome Again !! time limit per test 1 second memory limit per test 64 megabytes input sta ...
- codeforces 600C Make Palindrome
要保证变化次数最少就是出现次数为奇数的相互转化,而且对应字母只改变一次.保证字典序小就是字典序大的字母变成字典序小的字母. 长度n为偶数时候,次数为奇数的有偶数个,按照上面说的搞就好了. n为奇数时, ...
- 【Codeforces 486C】Palindrome Transformation
[链接] 我是链接,点我呀:) [题意] 光标一开始在p的位置 你可以用上下左右四个键位移动光标(左右)或者更改光标所在的字符(上下增加或减少ascill码) 问你最少要操作多少次才能使得字符串变成回 ...
- Codeforces 1304B. Longest Palindrome
根据数据范围,暴力可以解决,对每一个串,找与其互为回文的串,或者判断自身是否为回文串,然后两两将互为回文的串排列在头尾,中间放且只能最多放一个自身为回文串的串,因为题目说每个串都是不同的 #inclu ...
- Codeforces Round #389 Div.2 D. Santa Claus and a Palindrome
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- Educational Codeforces Round 2 C. Make Palindrome 贪心
C. Make Palindrome Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/pr ...
- Codeforces Gym 100570 E. Palindrome Query Manacher
E. Palindrome QueryTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100570/pro ...
随机推荐
- Beta阶段总结分析报告
1 讨论照片 2 Postmortem结果 二手交易平台项目Postmortem结果 整理:程环宇 设想和目标 1. 我们的软件要解决什么问题?是否定义得很清楚?是否对典型用户和典型场景有 ...
- 四则运算----C++版
一.设计思想 因java中已做过,就是简单的将java中的语句调换为C++的语句. 二.代码 #include<iostream.h> #include<Stdlib.h> v ...
- NO.7 项目需求分析
NO.7 项目需求分析 由于我们组的第一次选题并没有通过,所以我们又重新选择了一个题目--高校学生征信系统. 结合老师的作业要求,我们对该项目进行了详细的需求分析,软件需求规格说明书地址请点击这里.软 ...
- 判断mine类型
var http = require("http"); var fs = require("fs"); var url = require("url& ...
- nyoj 对决吃桃
时间限制:3000 ms | 内存限制:65535 KB 难度:0 描述 有一堆桃子不知数目,猴子第一天吃掉一半,又多吃了一个,第二天照此方法,吃掉剩下桃子的一半又多一个,天天如此,到第m天早 ...
- MongoDB 副本集管理
一.以单机模式启动成员节点 有时候出于维护的需要,需要以单机模式启动某个节点而不是一个副本集成员身份. 1).首先查询服务器命令行参数 db.serverCmdLineOpts() 2).关闭当前副本 ...
- JAVA_SE基础——42.final修饰符
高手勿喷~ final关键字可用于修饰类.变量和方法,它有"这是无法改变的"或者"最终"的含义,因此被final修饰的类.变量和方法将具有以下特征: 1.fin ...
- Windows 的Apache支持SSI配置
配置SSI什么是shtml? 使用SSI(Server Side Include)的html文件扩展名,SSI(Server Side Include),通常称为"服务器端嵌入"或 ...
- java图片处理开源框架
java图片处理开源框架 以前一直不明白,java开源框架什么意思,搜集资料得出以下结论 其实java框架可以理解为一个工具或者一个插件,将一个公用的.常用的技术封装起来,处理一些基础的.繁琐的问题. ...
- typescript简介
微软作为编译器狂魔一直有一个心病,就是改良JavaScript这种语法超级烂又很多人用的编程语言,于是TypeScript诞生了 先做个对比吧: TS JS 语法严谨性 严谨 宽松 静态性 静态 ...