codeforces 688B B. Lovely Palindromes(水题)
题目链接:
1 second
256 megabytes
standard input
standard output
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.
Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them.
Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number?
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
Print the n-th even-length palindrome number.
1
11
10
1001 题意: 问长度为偶数的第n个回文数是多少; 思路: 把这个字符串输出一遍再倒过来输出一遍就是答案了; AC代码:
//#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <queue>
#include <cmath>
#include <map>
#include <cstring>
#include <algorithm>
#include <cstdio> using namespace std;
#define Riep(n) for(int i=1;i<=n;i++)
#define Riop(n) for(int i=0;i<n;i++)
#define Rjep(n) for(int j=1;j<=n;j++)
#define Rjop(n) for(int j=0;j<n;j++)
#define mst(ss,b) memset(ss,b,sizeof(ss));
typedef long long LL;
template<class T> void read(T&num) {
char CH; bool F=false;
for(CH=getchar();CH<''||CH>'';F= CH=='-',CH=getchar());
for(num=;CH>=''&&CH<='';num=num*+CH-'',CH=getchar());
F && (num=-num);
}
int stk[], tp;
template<class T> inline void print(T p) {
if(!p) { puts(""); return; }
while(p) stk[++ tp] = p%, p/=;
while(tp) putchar(stk[tp--] + '');
putchar('\n');
} const LL mod=1e9+;
const double PI=acos(-1.0);
const LL inf=1e18;
const int N=1e5+;
const int maxn=;
const double eps=1e-; char s[N];
int main()
{ scanf("%s",s);
int len=strlen(s);
for(int i=;i<len;i++)
{
printf("%c",s[i]);
}
for(int i=len-;i>=;i--)
{
printf("%c",s[i]);
} return ;
}
codeforces 688B B. Lovely Palindromes(水题)的更多相关文章
- Codeforces Round #360 (Div. 2) B. Lovely Palindromes 水题
B. Lovely Palindromes 题目连接: http://www.codeforces.com/contest/688/problem/B Description Pari has a f ...
- codeforces 577B B. Modulo Sum(水题)
题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树
A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...
- codeforces 696A Lorenzo Von Matterhorn 水题
这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...
- CodeForces 589I Lottery (暴力,水题)
题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...
- Codeforces Gym 100286G Giant Screen 水题
Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...
- codeforces 710A A. King Moves(水题)
题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include ...
- codeforces 659A A. Round House(水题)
题目链接: A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard ...
- CodeForces 489B BerSU Ball (水题 双指针)
B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...
随机推荐
- 实现List集合中数据逆序排列
Collections.reverse(list); 实现list集合逆序排列
- MySQL语句之or和and多条件查询
在where中可以包含任意数目的and和or操作符,需要注意的是在没有任何其他符号的时候,例如括号,AND的优先级高于OR,因此,当两者一起使用时,先运算AND两边的条件表达式,再运算OR两边的条件表 ...
- Linux(Centos6.5)+Nginx+PHP-fpm+Mysql配置
第一步:准备安装包 1.从[](http://nginx.org/en/download.html).下载nginx 源码包 //NOTE! 下载稳定版本 2.从[](http://php.net/d ...
- tree(poj 1741)
题意:给一颗n个节点的树,每条边上有一个距离v(v<=1000).定义d(u,v)为u到v的最小距离.给定k值,求有多少点对(u,v)使u到v的距离小于等于k. /* 照着点分治模板敲了敲,有很 ...
- msp430入门编程26
msp430中C语言开发工具应用 msp430入门学习 msp430入门编程
- 设置select的默认选项
2014-01-07 09:54:34| 通过后台传出的值进行选择默认项的设置 <select name="user_id" id="user_id" ...
- Spring基础入门(二)
一.AOP 1.AOP概念 aop:面向切面编程,扩展功能不修改源代码实现. AOP采取横向抽取机制,取代了传统纵向继承体系重复性代码. 2.AOP原理 (1)第一种情况,有接口情况,使用动态代理创建 ...
- eclipse工程设置项目jre
Eclipse 是一个开放源代码的.基于Java的可扩展开发平台.就其本身而言,它只是一个框架和一组服务,用于通过插件组件构建开发环境.当我们导入已经存在项目或者通过svn引入项目时经常出现红叉叉的情 ...
- 【转】ubuntu 下安装mongodb php 拓展的方法
按照上面的方法安装成功之后,写一个 mongodb 的php测试脚本,用来测试是否可以 正确连接上mongodb ,并查询结果. 参考:http://php.net/manual/en/class.m ...
- 【转】如何查看Oracle客户端版本及位数(Windows系统)
一.方法一 查看oracle客户端版本:sqlplus -v 查看oracle客户端版本:sqlplus /nolog命令 Step 1:运行sqlplus /nolog命令,如果你服务器安装了多个客 ...