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 ;
}
最新文章
- spider RPC框架的需求来源与特性介绍(一)
- linux用户管理(二)
- python走起之第十一话
- SQL Server 2012 AlwaysOn 亲身实历记
- 个性二维码开源专题<;液化/圆角/效果>;
- Verilog语法基础讲解之参数化设计
- 四则运算三+psp0级表格
- Hacker(四)----查看计算机的IP地址
- POJ 3376 Finding Palindromes(扩展kmp+trie)
- java编程基础复习-------第二章
- angularJS的一点小笔记
- Crazy Calendar (阶梯博弈变形)
- Nginx性能优化技巧(6)
- Oracle ADDM报告生成和性能分析
- Ehcache计算Java对象内存大小
- python前后端加密方式
- C# 窗体内有子控件时鼠标检测
- 利用sqoop将hive数据导入导出数据到mysql
- 给Ubuntu18.04安装mac os主题<;转载>;
- Oracle ORA-12541:TNS:无监听程序