Decoding Baby Boos UVALive
来源:互联网 发布:魔兽争霸3全屏软件 编辑:程序博客网 时间:2024/05/01 07:19
原题传送门 :https://cn.vjudge.net/problem/UVALive-6917
题意很简单的一道题,甚至很多大牛都没读题目看了输入输出直接敲,我们出了一个问题,超时三发。这道题罚时太严重。罚时多,过得慢,应该好好思考一下自己队伍的状态
现在总结做法如下:
#include <iostream>#include <cstring>#include <cmath>#include <cstdio>#define inf 0x3f3f3fusing namespace std;char s[110000];int main (){ int t; scanf("%d",&t); getchar(); while(t--) { char v[30]= {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; scanf("%s",s); int m; scanf("%d",&m); char a,b; while(m--) { getchar(); scanf("%c %c",&a,&b); for(int i=0; i<26; i++) //根据 样例输入2,就找到这个问题了, { if(v[i]==b) v[i]=a; } } //如果,v的值没有 改变 那么s[i] = v[s[i]-'A']是一定的 如果出现了变化,v【i】也发生了变化,这样就把算法的复杂度降了下来。 int n=strlen(s); for(int i=0; i<n; i++) { if(s[i]>='A' &&s[i]<='Z') s[i]=v[s[i]-'A']; } printf("%s\n",s); }}
阅读全文
0 0
- Decoding Baby Boos UVALive
- UVALive 6917Decoding Baby Boos(签到)
- UVA 12897 Decoding Baby Boos
- A - Decoding Baby Boos---(2015 NEUQ_ACM summer training #1)
- Regionals 2014 >> Asia - Dhaka >> 6917 - Decoding Baby Boos
- BABY
- baby
- baby
- Baby
- boos相关内容
- baby,baby
- boos.Program_options使用记录
- boos::asio- based SuperCom
- Needy Baby Greedy Baby
- UVALive
- UVALive
- UVALive
- UVALive
- Redis---- Windows 开机自启的三种方法
- Android 判断App是否在后台运行
- HDU 1533 Going Home (KM)
- ios 各种动画机制
- 自学机器学习技术,网上搜到的一些建议
- Decoding Baby Boos UVALive
- [技术问题]MySQL数据库的“十宗罪”的治理
- cordova打包安卓自己生成keystore文件,用于打包release版本的APK
- linux ulimit
- 2.2.9—单链表—Reverse Nodes in k-Group
- python+Eclipse+pydev环境搭建
- MySQL C API总结
- 1979-爬楼梯
- 最短路水题