ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) A
2 seconds
256 megabytes
standard input
standard output
You are given a string A. Find a string B, where B is a palindrome and A is a subsequence of B.
A subsequence of a string is a string that can be derived from it by deleting some (not necessarily consecutive) characters without changing the order of the remaining characters. For example, "cotst" is a subsequence of "contest".
A palindrome is a string that reads the same forward or backward.
The length of string B should be at most 104. It is guaranteed that there always exists such string.
You do not need to find the shortest answer, the only restriction is that the length of string B should not exceed 104.
First line contains a string A (1 ≤ |A| ≤ 103) consisting of lowercase Latin letters, where |A| is a length of A.
Output single line containing B consisting of only lowercase Latin letters. You do not need to find the shortest answer, the only restriction is that the length of string B should not exceed 104. If there are many possible B, print any of them.
aba
aba
ab
aabaa
In the first example, "aba" is a subsequence of "aba" which is a palindrome.
In the second example, "ab" is a subsequence of "aabaa" which is a palindrome.
感想:大水题 但是 1e3*2=2e3<1e4 一直以为大于后者 导致写了很久 算了 就算学了STL
code1
#include<string.h>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
#define MAX 0x3f3f3f3f
#define fi first
#define se second
#define Len 1e8+5
int main()
{
string s,a; //字符串用string 不是char
cin>>s;
cout<<s;
a.assign(s.rbegin(),s.rend());
cout<<a<<endl; //换行不换行是有区别的 }
code2
#include<string.h>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
#define MAX 0x3f3f3f3f
#define fi first
#define se second
#define Len 1e8+5
int main()
{
string s;
cin>>s;
cout<<s;
reverse(s.begin(),s.end()); //
cout<<s<<endl;
}
ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) A的更多相关文章
- Codeforces 932 A.Palindromic Supersequence (ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined))
占坑,明天写,想把D补出来一起写.2/20/2018 11:17:00 PM ----------------------------------------------------------我是分 ...
- ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined)
靠这把上了蓝 A. Palindromic Supersequence time limit per test 2 seconds memory limit per test 256 megabyte ...
- Codeforces 932 C.Permutation Cycle-数学 (ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined))
C. Permutation Cycle time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- Codeforces 932 B.Recursive Queries-前缀和 (ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined))
B. Recursive Queries time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- 【ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) D】Tree
[链接] 我是链接,点我呀:) [题意] 让你在树上找一个序列. 这个序列中a[1]=R 然后a[2],a[3]..a[d]它们满足a[2]是a[1]的祖先,a[3]是a[2]的祖先... 且w[a[ ...
- 【ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) C】 Permutation Cycle
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] p[i] = p[p[i]]一直进行下去 在1..n的排列下肯定会回到原位置的. 即最后会形成若干个环. g[i]显然等于那个环的大 ...
- 【ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) B】Recursive Queries
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 写个记忆化搜索. 接近O(n)的复杂度吧 [代码] #include <bits/stdc++.h> using nam ...
- 【ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) A】 Palindromic Supersequence
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 字符串倒着加到原串右边就好 [代码] #include <bits/stdc++.h> using namespace ...
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) A map B贪心 C思路前缀
A. A Serial Killer time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
随机推荐
- quartz demo01
1,Pom.xml 加入:quartz-2.1.7.jar <dependency> <groupId>org.quartz-scheduler</groupId&g ...
- [12]Windows内核情景分析 --- MDI
Mdl意为'内存映射描述符'.'缓冲描述符',一个mdl就代表一个缓冲.(任意一块物理内存,可以同时映射到用户地址空间和系统地址空间的) 设备IO方式分为三种:缓冲方式.直接IO方式.直接方式 缓冲方 ...
- GetWindowRect和GetClientRect的注意事项
发现GetClientRect()函数取值不正确,特此找来了些资料以供参考,具体如下,就可以明白怎么回事了. 一:关于坐标 MFC中绘图时经常涉及到坐标计算,GetWindowRect和GetClie ...
- Day11 多进程与多线程编程
一.进程与线程 1.什么是进程(process)? An executing instance of a program is called a process. Each process provi ...
- pyinstaller将python脚本生成exe
一.下载pyinstaller 二.生成exe 下载pyinstaller 1.在C:\python27\Scripts目录下打开cmd界面,执行命令:pip install PyInstaller ...
- 【2017-03-23】CSS基础:内联样式
CSS:层叠式样式表 1.对层标签整体进行操作 <div style="width:200px;height:200px;background-color:blue"> ...
- QScrollBar & QSlider & QDial
[1]滚动条 & 滑块 & 表盘 Qt示例工程: (1)slidergroup.h #include <QGroupBox> QT_BEGIN_NAMESPACE clas ...
- Spring boot jackson
Spring boot 所引用的包里面包含 jackson-databind-2.8.3.jar jackson-annotations-2.8.3.jar jackson-core-2.8.3.ja ...
- linux查看系统状态的命令
vmstat查看机器实时的综合情况:load,内存,swap,cpu使用率等方面 procs: r:运行队列中进程数量 b:等待IO的进程数量 memory(内存): swpd:使用虚拟内存大小 fr ...
- tensorflow--variable_scope
1.with tf.variable_scope(name , reuse = reuse) (1)创建variable scope with tf.variable_scope("foo& ...