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
----------------------------------------------------------我是分割线-------------------------------------------------------
我来了,本来打算D题写到一起的,但是有新的东西要写,D就单独写一篇,这里写A,B,C;
开启智障模式:(看我咸鱼突刺的厉害( • ̀ω•́ )✧) 2/21/2018 10:46:00 PM
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.
这道题完全直接就OK,emnnn,哈哈哈,直接倒着再来一遍就可以。
代码:
//A. Palindromic Supersequence-水题
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
const int maxn=+;
char a[maxn],b[*maxn];
int main(){
while(~scanf("%s",a)){
memset(b,,sizeof(b));
int len=strlen(a);
int h=;
for(int i=;i<len;i++)
b[h++]=a[i];
for(int i=len-;i>=;i--)
b[h++]=a[i];
printf("%s\n",b);
}
return ;
}
Codeforces 932 A.Palindromic Supersequence (ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined))的更多相关文章
- ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) A
2018-02-19 A. Palindromic Supersequence time limit per test 2 seconds memory limit per test 256 mega ...
- Codeforces 932.A Palindromic Supersequence
A. Palindromic Supersequence time limit per test 2 seconds memory limit per test 256 megabytes input ...
- 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 ...
- 【ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) A】 Palindromic Supersequence
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 字符串倒着加到原串右边就好 [代码] #include <bits/stdc++.h> using namespace ...
- 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 ...
随机推荐
- vue + axios---封装一个http请求
在使用vue开发时,官方推荐使用axios来请求接口 // axios官方地址 https://github.com/axios/axios 但是axios并不像 vue-resource 一样拥有i ...
- 双击内容变input框可编辑,失去焦点后修改的数据异步提交
<html> <head> <meta charset="utf8"> <script src="https://cdn.boo ...
- python之自定义排序函数sorted()
sorted()也是一个高阶函数,它可以接收一个比较函数来实现自定义排序,比较函数的定义是,传入两个待比较的元素 x, y,如果 x 应该排在 y 的前面,返回 -1,如果 x 应该排在 y 的后面, ...
- IOC容器和Bean的配置实例
实验1: <!--实验1:通过IOC容器创建对象,并为属性赋值 --> <!-- 需要由IOC容器创建对象的全类名 --> <!-- 为了便于从IOC容器中获取book对 ...
- POJ:1753-Flip Game(二进制+bfs)
题目链接:http://poj.org/problem?id=1753 Flip Game Time Limit: 1000MS Memory Limit: 65536K Description Fl ...
- re--findall 【转】
原文链接 python re 模块 findall 函数用法简述 代码示例: >>> import re >>> s = "adfad asdfasdf ...
- windows下创建子进程过程中代码重复执行问题
windows在启动子进程的时候会将主进程文件倒入到子进程中.导入模块就相当于执行这个模块中的代码, 所以第一个print会在主进程中执行一次,又在被导入的过程中在子进程中又执行了一次. p.star ...
- UTV - URL Tag Validation
What`s UTV 1.URL Tag Validation 2.Special format of URL for preventing unauthorized usage and access ...
- ogre3D程序实例解析1-平移旋转与缩放
接着上篇写 http://www.cnblogs.com/songliquan/p/3294902.html 旋转 这里有必要看一下关于旋转的源代码: virtual void pitch(co ...
- PHPStorm.WebStrom等系列官方开发工具配置本地项目与运程服务器同步
PHPStorm.WebStrom配置本地项目与运程服务器同步 说明:PHPStorm.WebStrom等官方的系统开发工具配置本地项目与运程服务器同步的方法都基本一致没有,几乎没有什么不同之处,我们 ...