CodeFroces 831B. Keyboard Layouts(构造题)
来源:互联网 发布:淘宝网店实战宝典txt 编辑:程序博客网 时间:2024/06/17 05:40
http://codeforces.com/problemset/problem/831/B
题目大意:给出两个键盘,他们布局相同,只是他们对应位置的字母不一定相同。然后给出一段字符串,由第一个键盘打出,现在要求在和第一个键盘相同的键位上用第二个键盘打出一段字符串。
解法:怎么搞都行。
代码如下:
#include<bits/stdc++.h>using namespace std;int main() {char str1[35], str2[35], tmp[1005], ans[1005];int cnt[35];scanf("%s", str1);scanf("%s", str2);scanf("%s", tmp);for(int i = 0; str1[i]; i++) {cnt[str1[i] - 'a'] = i;}for(int i = 0; tmp[i]; i++) {if(tmp[i] >= 'a' && tmp[i] <= 'z')ans[i] = str2[cnt[tmp[i] - 'a']];else if(tmp[i] >= 'A' && tmp[i] <= 'Z')ans[i] = str2[cnt[tmp[i] - 'A']] - 32;elseans[i] = tmp[i];}ans[strlen(tmp)] = '\0';printf("%s\n", ans);return 0;}
阅读全文
0 0
- CodeFroces 831B. Keyboard Layouts(构造题)
- CodeForces 831B Keyboard Layouts
- Codeforces 831 B Keyboard Layouts
- CodeForces 831B-Keyboard Layouts
- codeforces 831B Keyboard Layouts
- CodeForces 831 B.Keyboard Layouts(水~)
- cf424div2 B. Keyboard Layouts
- Codeforces831 B. Keyboard Layouts
- B. Keyboard Layouts
- CodeFroces 823B. Petya and Exam(构造题)
- CodeFroces 831A. Unimodal Array(构造题)
- Keyboard Layouts
- Codeforces Round #424 (Div. 2) B Keyboard Layouts 思维题 字符串处理
- CodeFroces 827B. High Load(构造法)
- Codeforces Round #424 (Div. 2) B. Keyboard Layouts(字符串)
- Codeforces Round #424 (Div. 2) B. Keyboard Layouts
- Codeforces Round #424 (Div. 2) B. Keyboard Layouts
- CodeFroces 814B An express train to reveries(构造题)
- TEST
- 牛顿迭代法算近似平方根
- node-开始
- Java多线程____Volatile使用和原理
- Lucene--全文检索的基本原理
- CodeFroces 831B. Keyboard Layouts(构造题)
- 判断一个链表是否为回文结构
- Nginx+Nginx-rtmp-module做在线直播服务器及在线录播
- 安装nvidia驱动
- Mysql 分表,分区,分库/分片(sharding)
- CSS:导航菜单的制作
- centos7 redis开机自启动
- UE4_AActor类
- URL链接中文参数乱码的若干处理方法