E - Lovely Palindromes

Description

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.

Sample Input

Input

1

Output

11

Input

10

Output

1001

水题!!

正反个输出一次。

附AC代码:

 1 #include<iostream>
 2 #include<cstring>
 3 #include<cstdio>
 4 using namespace std;
 5
 6 int main(){
 7     string s;
 8     while(cin>>s){
 9         cout<<s;
10         for(int i=s.size()-1;i>=0;i--){
11             cout<<s[i];
12         }
13         cout<<endl;
14     }
15     return 0;
16 }
时间: 2024-09-30 02:00:08

E - Lovely Palindromes的相关文章

CodeForces 688B - Lovely Palindromes(思路)

题意:输出第n(1 <= n <= 10^100000)大的偶数长度的回文数.(最小的为11) 因为长度是偶数,所以前后两半之间是相互对称的,又因为一个数字的大小主要取决于较高位数的大小,所以数字的前一半决定数的大小,从1开始,1,2,3--对称即可得11,22,33-- 所以将数正着输出后再倒着输出一遍即可(数非常大,需用字符串存) #include<cstdio> #include<cstring> #include<cctype> #include&l

套题 codeforces 360

A题:Opponents 直接模拟 #include <bits/stdc++.h> using namespace std; char ch[200]; int main() { int n,k; while(~scanf("%d%d",&n,&k)) { int p=0,sta=1,first=1,ans; for(int i=0;i<k;i++) { sta=1; scanf("%s",ch); for(int i=0;i&l

Codeforces Round #360 B

Lovely Palindromes 题意:给一个n,求第n大的长度为偶数的回文数字 思路:只考虑回文的前一半数字,因为前面是高位,肯定优先满足高位,第n大是数字就是n,后半部分由回文自动满足得到,所以其实就是正着输出一遍,倒着再输出一遍 AC代码: #include "iostream" #include "string.h" #include "stack" #include "queue" #include "

[UVa] Palindromes(401)

UVA - 401 Palindromes Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu Submit Status Description A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDED

uva 11584 Partitioning by Palindromes 线性dp

// uva 11584 Partitioning by Palindromes 线性dp // // 题目意思是将一个字符串划分成尽量少的回文串 // // f[i]表示前i个字符能化成最少的回文串的数目 // // f[i] = min(f[i],f[j-1] + 1(j到i是回文串)) // // 这道题还是挺简单的,继续练 #include <algorithm> #include <bitset> #include <cassert> #include <

Codeforces Round #316 (Div. 2)E. Pig and Palindromes DP

E. Pig and Palindromes Peppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of n rows and m columns. We enumerate the rows of the rectangle from top to bottom with numbe

Codeforces #316 E Pig and Palindromes DP

// Codeforces #316 E Pig and Palindromes // // 题目大意: // // 给你一张地图,n*m每个点是一个字母,现在从(0,0)出发, // 每次只能往右或者往下走,求走到(n-1,m-1)形成回文串的方法数. // // 解题思路: // // 动态规划.首先.如果起点和终点的字母不相同,那么肯定 // 不能形成回文串,直接输出0.对于能形成回文串.我们设状态 // d(step,i,j)表示走了step步,从第0行走到i行,第n-1行走到j行的 /

UVA11584---Partitioning by Palindromes(dp)

We say a sequence of characters is a palindrome if it is the same written forwards and backwards. For exam- ple, ' racecar ' is a palindrome, but ' fastcar ' is not. A partition of a sequence of char- acters is a list of one or more disjoint non-empt

UVa 401 Palindromes(字符串,回文)

 Palindromes  A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the string is read from left to right as when the string i