CodeForces 688B - Lovely Palindromes
来源:互联网 发布:淘宝刀具店 编辑:程序博客网 时间:2024/06/05 11:45
题意:输出第n(1 <= n <= 10^100000)大的偶数长度的回文数。(最小的为11)
因为长度是偶数,所以前后两半之间是相互对称的,又因为一个数字的大小主要取决于较高位数的大小,所以数字的前一半决定数的大小,从1开始,1,2,3……对称即可得11,22,33……
所以将数正着输出后再倒着输出一遍即可(数非常大,需用字符串存)
#include<cstdio>#include<cstring>#include<cctype>#include<cstdlib>#include<cmath>#include<iostream>#include<sstream>#include<iterator>#include<algorithm>#include<string>#include<vector>#include<set>#include<map>#include<deque>#include<queue>#include<stack>#include<list>typedef long long ll;typedef unsigned long long llu;const int MAXN = 100 + 10;const int MAXT = 1000000 + 10;const int INF = 0x7f7f7f7f;const double pi = acos(-1.0);const double EPS = 1e-6;using namespace std;string s;int main(){ cin >> s; cout << s; reverse(s.begin(), s.end()); cout << s << endl; return 0;}
0 0
- Codeforces-688B Lovely Palindromes
- CodeForces 688B Lovely Palindromes
- CodeForces 688B - Lovely Palindromes
- codeforces 688B Lovely Palindromes
- 688B: Lovely Palindromes
- CodeForces 688B Lovely Palindromes(偶数位回文数)
- B. Lovely Palindromes
- Codeforces Round #360 (Div. 2) B. Lovely Palindromes
- Codeforces Round #360 (Div. 2) B Lovely Palindromes(水题)
- Codeforces Round #360 (Div. 2) B. Lovely Palindromes
- Codeforces Round #360 (Div. 2)-B. Lovely Palindromes
- Codeforces Round #360 (Div. 2) B. Lovely Palindromes
- Codeforces Round #360 (Div. 2) B Lovely Palindromes
- Codeforces-688B Lovely Palindromes和Codeforces-630A-Again Twenty Five!(两道傻X题,借此秀一下python的简洁)
- Lovely Palindromes
- CodeForces 688BLovely Palindromes
- lovely
- codeforces Palindromes 资源背包
- 如何将class文件打包jar
- 《UNIX网络编程卷1:套接字联网API》读书笔记- 基本 TCP 套接字编程(1)
- Fragment生命周期详解
- java NIO的理解(1)
- git命令使用
- CodeForces 688B - Lovely Palindromes
- Marklogic学习 由浅入深(C)—— Marklogic的方言XQuery Dialects
- Linux-find命令应用举例-按时间筛选和删除文件
- @font-face的使用
- [Erlang 学习笔记]erlang behaviour小结之gen_server
- LightOJ 1317 (据说是概率DP的...水题)
- Android设计模式之浅谈MVP
- QQ通信原理概述
- 浙大PAT甲级 1073