PAT Advanced 1035
来源:互联网 发布:程序员述职报告范文 编辑:程序博客网 时间:2024/06/05 07:41
题意:
给你一些字符串,对于一些特殊的字符要进行转换。
需要注意的地方:
If no account is modified, print in one line "There are N accounts and no account is modified" where N is the total number of accounts. However, if N is one, you must print "There is 1 account and no account is modified" instead.是这句话。。。。。如果总数是1且不用改的话,那么accounts要写成account。。。。。我在这没认真读题被坑了一下
#include<iostream>#include<string>#include<fstream>#include<map>using namespace std;//ifstream fin("fin.txt");//streambuf *old = cin.rdbuf(fin.rdbuf());int times;map<string,string>mymap;string temp;string m[1111];string modify[1111];int k = 0;string pos;void solve(){bool flag = true;for (int i = 0; i < times; i++){temp = m[i];pos = temp;temp = mymap[temp];flag = true;int length = temp.length();for (int j = 0; j < length; j++){if (temp[j] == '1'){temp[j] = '@';flag = false;}else if (temp[j] == '0'){temp[j] = '%';flag = false;}else if (temp[j] == 'l'){temp[j] = 'L';flag = false;}else if (temp[j] == 'O'){temp[j] = 'o';flag = false;}}if (!flag){modify[k++] = pos;mymap[pos] = temp;}}if (k == 0){if (times == 1)cout << "There is 1 account and no account is modified" << endl;elsecout << "There are " << times << " accounts and no account is modified" << endl;}else{cout << k << endl;for (int i = 0; i < k; i++){cout << modify[i] << " " << mymap[modify[i]] << endl;}}}void input(){cin >> times;string mt;for (int i = 0; i < times; i++){cin >> m[i] >> mt;;mymap[m[i]] = mt;}solve();}int main(){input();return 0;}
0 0
- pat-advanced(1035-1038)
- PAT Advanced 1035
- PAT (Advanced Level) Practise 1035
- Pat(Advanced Level)Practice--1035(Password)
- PAT (Advanced Level) Practise 1035 Password (20)
- PAT (Advanced Level) Practise 1035 Password (20)
- PAT Advanced 1065
- PAT Advanced 1001
- PAT Advanced 1043
- PAT Advanced 1042
- PAT Advanced 1067
- PAT Advanced 1066
- PAT Advanced 1005
- pat advanced 1044
- pat advanced 1042
- pat advanced 1043
- pat advanced 1032
- pat:1002(Advanced)
- HDU 5032 Always Cook Mushroom (2014年北京赛区现场赛A题)
- 9.3小假期
- "抱歉,无法发起临时会话,您可以 添加对方为好友以发送消息"解决办法
- 【读书有感】如何高效学习
- mysql外连接查询用法
- PAT Advanced 1035
- ACM_快速幂
- stm32之keil开发环境搭建
- csdn设置自己的博客栏目
- 自学QT之颜色选择对话框
- Cocos2d-x tinyxml2用于xml的解析,自动生成xml文件和解析xml文件
- 运行时异常与一般异常有何异同
- 学数学的伤不起
- 在Struts2中jsp前台传值到后台的三种方法