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. (转)SPFA算法

    原文地址:http://www.cnblogs.com/scau20110726/archive/2012/11/18/2776124.html 粗略讲讲SPFA算法的原理,SPFA算法是1994年西 ...

  2. MyISAM引擎的特点及优化方法

    1.什么是MyISAM引擎?MyISAM引擎是MySQL关系数据库管理系统的默认存储引擎(MySQL5.5.5以前),这种MySQL的表存储结构从旧的ISAM代码扩展出许多有用的功能.在存储的时候,每 ...

  3. python2和python3 print输出不换行

    python2 print不换行 在print最后加上一个逗号,会把两个输出打印在同一行,不过两个输出之间有一个空格的间隔,例如:print '{0}'.format(123),print '{0}' ...

  4. Gym - 100502G Outing (强连通缩点+树形依赖背包)

    题目链接 问题:有n个人,最多选k个,如果选了某个人就必须选他指定的另一个人,问最多能选多少个人. 将每个人所指定的人向他连一条单向边,则每一个点都有唯一的前驱,形成的图是个基环树森林,在同一个强连通 ...

  5. hashmap&linkedlist

    import java.util.HashMap; import java.util.Iterator; public class hashmap1 { public static void main ...

  6. 系列文章----.Net程序员学用Oracle系列

    .Net程序员学用Oracle系列(18):PLSQL Developer 攻略 .Net程序员学用Oracle系列(17):数据库管理工具(SQL Plus) .Net程序员学用Oracle系列(1 ...

  7. Mybatis相关SQL操作总结

    1.resultMap和resultType等参数以及结果集 <select id="getApplicationByRoleCode" resultType="p ...

  8. 如何打开 Windows 的热键提示

    如何打开 Windows 的热键提示 很早之前我记的 Windows 是有热键提示的,不知道什么时候开始默认不显示了,难道 微软是为是美观? 找了一下原来是有地方可以设置的.

  9. Windbg内核调试之一: Vista Boot Config设置

    Windbg进行内核调试,需要一些基本的技巧和设置,在这个系列文章中,我将使用Windbg过程中所遇到的一些问题和经验记录下来,算是对Kernel调试的一个总结,同时也是学习Windows系统内核的另 ...

  10. QString的拼接

    QString的append()函数则提供了类似的操作,例如: 1. str = "User: ";     2. str.append(userName);     3. str ...