简单hash[或者是哈希思想]
来源:互联网 发布:珍珠控制台模拟软件 编辑:程序博客网 时间:2024/06/05 22:32
题目链接
/*有一个长度为n的只包含小写字母的字符串s,有m次操作,每次输入2个字符A , B表示将s中的全部字符A变成B,B变成A。char sky[30],顺序记录每个字母的映射,在sky[]里做改变,然后将原字符串通过sky[]得到答案。//丑*/#include<cstdio>#include<cstring>#include<map>#include<cstring>#include<iostream>using namespace std;const int maxn=200000+10;char s[maxn];int n,m;char sky[30];char AA[10],BB[10];int main (){ scanf("%d%d",&n,&m); for(int i=0;i<26;i++) sky[i]='a'+i; scanf("%s",s); for(int i=0;i<m;i++) { scanf("%s %s",AA,BB); for(int i=0;i<=25;i++) { if(sky[i]==AA[0]) sky[i]=BB[0]; else if(sky[i]==BB[0]) sky[i]=AA[0]; } } for(int i=0;i<n;i++) printf("%c",sky[s[i]-'a']); printf("\n");}
0 0
- 简单hash[或者是哈希思想]
- hdu 4993(简单枚举或者hash)
- 动态hash思想方法
- Hash思想:映射
- 动态hash思想方法
- 动态hash思想方法
- hash 思想 应用于查找
- 简单Hash
- hdu1251 hash或者字典树
- hdu1247 字典树或者hash
- poj 2785 二分或者hash
- poj 1840 简单hash。
- 简单的Hash
- poj2503 简单的hash
- hash算法简单介绍
- hdu1280简单hash
- c 简单的hash
- hash表简单实现
- Fresco中的ImagePipeline
- 1032. Sharing (25)-PAT甲级真题
- Android中自定义组合控件
- hdu 5783——Divide the Sequence
- git管理项目 一些使用语句
- 简单hash[或者是哈希思想]
- Maven创建An internal error occurred during: "Retrieving archetypes:". Java heap space
- 剑指Offer: 扑克牌顺子
- 数据结构实验之求二叉树后序遍历和层次遍历 (sdut oj2137)
- HDU 5806 NanoApe Loves Sequence Ⅱ
- 1052. Linked List Sorting (25)-PAT甲级真题
- iOS-沙盒目录结构分析
- angularjs取到 My97DatePicker选中的值
- 1097. Deduplication on a Linked List (25)-PAT甲级真题