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 ...
随机推荐
- Linux下配置Django_Apache_Mysql环境(CentOS 7.5)
本文将介绍如何在Linux上部署Django + Mysql + Apache环境.我们知道,Django内置的http服务器只能工作在单线程下,做开发和调试时候是可以的,但是生产环境通常都会有多用户 ...
- tomcat报错:java.io.IOException: 您的主机中的软件中止了一个已建立的连接。
tomcat报错: org.apache.catalina.connector.ClientAbortException: java.io.IOException: 您的主机中的软件中止了一个已建立的 ...
- python3 兔子繁殖问题
题目 有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? 代码: month = int(input("繁殖 ...
- Geode 集群搭建,快速上手使用
Geode 介绍: Geode是一个提供实时.一致访问大型分布式云平台下数据密集型应用的数据管理平台. Geode 通过跨多进程,把内存.CPU.网络资源和可选的本地磁盘汇集起来,来管理应用程序对象及 ...
- STM32F407VET6之IAR之ewarm7.80.4工程建立(基于官方固件库1.6版本) 的工程文件目录
最后整理结构如下所示,├─cmsis│ startup_stm32f401xx.s│ startup_stm32f40xx.s│ startup_stm32f40_41xxx.s│ startup_s ...
- zigbee 中 OSAL 事件传递机制和消息传递机制
一.概述 OSAL (Operating System Abstraction Layer) ,翻译为"操作系统抽象层". OSAL 就是一种支持多任务运行的系统资源分配机制.OS ...
- source insight
关于source inlight的版本 http://www.camnpr.com/archives/559.html 最新版本 http://www.sourceinsight.com/upda ...
- Linux学习-什么是 X Window System
Unix Like 操作系统不是只能进行服务器的架设而已,在美编.排版.制图.多媒体应用上也是有其 需要的. 这些需求都需要用到图形接口 (Graphical User Interface, GUI) ...
- ogre的初始化与启动以及显示对象设置
ogre的使用方法1---自动设置 1.ogre初始化:首先实例化一个Root对象 Root * root = new Root(); Root * root = new Root("plu ...
- javascript是脚本语言?javascript万物皆对象?
呵呵哒!带你见识下js面对对象的魅力 是的是的,退后,朕要开始装逼了- 这是什么鸟东西?是的是的,装逼开始,2016年度最佳JS编译器,ES6标准出来后,小伙伴们对新特性摩拳擦掌,奈何浏览器支持把我们 ...