Ural 1654. Cipher Message
来源:互联网 发布:vmware for mac破解版 编辑:程序博客网 时间:2024/06/02 13:12
删掉连续的相同两个字母,直到不存在两个连续且相同的字母。
模拟一个栈即可。
#include<iostream>#include<cstdio>#include <cstring>#include <queue>#include <cmath>#include <algorithm>#include <cstdlib>#include <set>#include <vector>#include <map>using namespace std;#define eps 1e-7#define INF 0x3fffffff#define L(u) (u<<1)#define R(u) (u<<1|1)#define MID(l,r) ((l+r)>>1)#define M 1000000009const int maxn=200001;char s[maxn];char stk[maxn];int main(){ int top=0; memset(stk,0,sizeof(stk)); scanf("%s",s); stk[top++]=s[0]; int len=strlen(s); for(int i=1;i<len;i++) { if(stk[top-1]==s[i]) { top--; } else { stk[top++]=s[i]; } } stk[top++]=0; printf("%s\n",stk); return 0;}
- ural 1654. Cipher Message
- Ural 1654. Cipher Message
- Ural 1654. Cipher Message
- ural 1654. Cipher Message
- URAL 1654. Cipher Message (STL stack)
- ural 1654 Cipher Message
- URAL 1654 - Cipher Message
- Ural 1654 Cipher Message
- URAL 1654 Cipher Message
- URAL 1654 Cipher Message(栈)
- Ural 1706. Cipher Message 2 后缀数组
- URAL 1996 Cipher Message 3 (FFT + KMP)
- ural 1996. Cipher Message 3 KMP+FFT
- 【ural】1996. Cipher Message 3【FFT+KMP】
- URAL 1996 Cipher Message 3 FFT + KMP
- URAL 1996 Cipher Message 3 (FFT + KMP)
- URAL 1996 Cipher Message 3 FFT KMP
- 1654. Cipher Message timus
- 分布式搜索方案选型
- HashMap学习
- POJ 1990 MooFest(想法题&树状数组)
- hdu 1115 多边形重心
- C语言文件操作函数大全
- Ural 1654. Cipher Message
- 结合Github使用git管理代码的简便方法
- Android视角,精妙绝伦的回调方法
- 字符流缓冲区:BufferedWriter,BufferedReader
- dfs小结
- TCP/Socket学习--UDP段格式
- UVA10361- Automatic Poetry
- E: Sub-process /usr/bin/dpkg returned an error code 问题的解决办法
- 保障质量的工具