http://codeforces.com/problemset/problem/688/B

B. Lovely Palindromes
time limit per test

1 second

memory limit per test

256 megabytes

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?

Input

The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).

Output

Print the n-th even-length palindrome number.

Examples
Input
1
Output
11
Input
10
Output
1001
Note

The first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.

题意:找第n个偶数位数的对称数字。

思路:逻辑分析题。只看数字的一半(因为是偶数位数),它的一半是n,则它就是第n个符合要求的数。

代码:

 #include <iostream>
#include <cstring>
using namespace std; #define n 100005 int main ()
{
char s[n];
cin >> s;
int len = strlen(s);
for (int i = ; i < len; i++)
{
cout << s[i];
}
for (int i = len - ; i >= ; i--)
{
cout << s[i];
}
cout << endl;
return ;
}

cf688B-Lovely Palindromes的更多相关文章

  1. CF688B Lovely Palindromes 题解

    Content 输入一个数 \(n\),输出第 \(n\) 个偶数位回文数. 数据范围:\(1\leqslant n\leqslant 10^{10^5}\). Solution 一看这吓人的数据范围 ...

  2. Codeforces Round #360 (Div. 2) B. Lovely Palindromes 水题

    B. Lovely Palindromes 题目连接: http://www.codeforces.com/contest/688/problem/B Description Pari has a f ...

  3. codeforces 688B B. Lovely Palindromes(水题)

    题目链接: B. Lovely Palindromes time limit per test 1 second memory limit per test 256 megabytes input s ...

  4. CodeForces 688B Lovely Palindromes (水题回文)

    题意:给一个数n,让你找出长度为偶数,并且是第 n 个回文数. 析:你多写几个就知道了,其实就是 n,然后再加上n的逆序,不过n有点大,直接用string 好了. 代码如下: #include < ...

  5. E - Lovely Palindromes

    Description Pari has a friend who loves palindrome numbers. A palindrome number is a number that rea ...

  6. 套题 codeforces 360

    A题:Opponents 直接模拟 #include <bits/stdc++.h> using namespace std; ]; int main() { int n,k; while ...

  7. UVA - 11584 Partitioning by Palindromes[序列DP]

    UVA - 11584 Partitioning by Palindromes We say a sequence of char- acters is a palindrome if it is t ...

  8. hdu 1318 Palindromes

    Palindromes Time Limit:3000MS     Memory Limit:0KB     64bit                                         ...

  9. dp --- Codeforces 245H :Queries for Number of Palindromes

    Queries for Number of Palindromes Problem's Link:   http://codeforces.com/problemset/problem/245/H M ...

随机推荐

  1. 2016/05 - Mars ISC 面试过程全记录

    一.Mars phone interview 还记得当时我接到Mars phone interview的时候我还和女友在成都玩,真是[好事多磨 x1],猎头通知可能下午会打电话,早早的吃完午饭我就准备 ...

  2. Linux(CentOS)下.NET,mono环境的安装步骤整理

    本文Linux使用的是CentOS 7 1.软件下载 CentOS:https://www.centos.org/download/ mono-4.2.1.36.tar.bz2 http://down ...

  3. Win7 Nginx启动失败 cmd命令失败

    Win7  Nginx启动失败 cmd命令失败 Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服 ...

  4. 关于js序列化时间的方法

    var time = new Date(); var otime = getMyDate(time); //将毫秒转换成 年月日+时分秒 格式的 (1970-01-11 00:00:00) funct ...

  5. Java_脚本引擎_01_用法入门

    一.前言 最近有个需求,需要在js中调用java,这样能避免更新java,从而实现代码的热更新. 于是想到用 Nashorn JavaScript 引擎. 二.概述 通过 JDK 8 的 Nashor ...

  6. git教程3-添加远程库与从远程库拷贝

    一.添加到github 1.github上创建新的库learngit.git 2.git remote add origin git@github.com:moisiet/learngit.git  ...

  7. 关于 freetds pymssql 的安装部署

    关于 freetds pymssql 的安装部署一.安装: (freetds-0.91 pymssql 2.0.1) 如果要在linux机器 连mysqlsever 1.需要安装freetds./co ...

  8. VMware12版虚拟机怎么安装win7系统(详细教程

    转自:http://jingyan.baidu.com/article/cd4c29791fcf1b756e6e6034.html VMware12版虚拟机怎么安装win7系统(详细教程) 现 在很多 ...

  9. electron 安装失败解决办法

    1.安装node https://nodejs.org/en/download/2.安装镜像工具npm install -g cnpm --registry=https://registry.npm. ...

  10. POJ1061(线性同余方程)

    青蛙的约会 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 105587   Accepted: 20789 Descript ...