PAT 甲级 1035 Password (20 分)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1
(one) from l
(L
in lowercase), or 0
(zero) from O
(o
in uppercase). One solution is to replace 1
(one) by @
, 0
(zero) by %
, l
by L
, and O
by o
. Now it is your job to write a program to check the accounts generated by the judge, and to help the juge modify the confusing passwords.
Input Specification:
Each input file contains one test case. Each case contains a positive integer N (≤1000), followed by N lines of accounts. Each account consists of a user name and a password, both are strings of no more than 10 characters with no space.
Output Specification:
For each test case, first print the number M of accounts that have been modified, then print in the following M lines the modified accounts info, that is, the user names and the corresponding modified passwords. The accounts must be printed in the same order as they are read in. 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.
Sample Input 1:
3
Team000002 Rlsp0dfa
Team000003 perfectpwd
Team000001 R1spOdfa
Sample Output 1:
2
Team000002 RLsp%dfa
Team000001 R@spodfa
Sample Input 2:
1
team110 abcdefg332
Sample Output 2:
There is 1 account and no account is modified
Sample Input 3:
2
team110 abcdefg222
team220 abcdefg333
Sample Output 3:
There are 2 accounts and no account is modified
#include<iostream>
#include<string>
#include<vector> using namespace std; bool judge(string& str)
{
bool flag = false; for(int i=;i<str.size();++i)
{
switch(str[i])
{
case '': str[i] = '@';flag = true;break;
case '': str[i] = '%';flag = true;break;
case 'l': str[i] = 'L';flag = true;break;
case 'O': str[i] = 'o';flag = true;break;
}
} return flag;
} int main()
{
int N;
string str1,str2;
vector<string> v; cin>>N; for(int i=;i<N;++i)
{
cin>>str1>>str2; if(judge(str2))
{
v.push_back(str1);
v.push_back(str2);
}
} if(v.size() == && N == )
cout<<"There is 1 account and no account is modified"<<endl;
else if(v.size() == && N > )
cout<<"There are " << N <<" accounts and no account is modified"<<endl;
else
{
cout<<v.size()/<<endl; for(int i=;i<v.size();i+=)
cout<<v[i]<<" "<<v[i+]<<endl;
}
}
PAT 甲级 1035 Password (20 分)的更多相关文章
- PAT 甲级 1035 Password (20 分)(简单题)
1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for ...
- PAT甲级——1035 Password (20分)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- PAT Advanced 1035 Password (20 分)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...
- PAT 甲级 1077 Kuchiguse (20 分)(简单,找最大相同后缀)
1077 Kuchiguse (20 分) The Japanese language is notorious for its sentence ending particles. Person ...
- PAT 甲级 1061 Dating (20 分)(位置也要相同,题目看不懂)
1061 Dating (20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDk ...
- 【PAT甲级】1035 Password (20 分)
题意: 输入一个正整数N(<=1000),接着输入N行数据,每行包括一个ID和一个密码,长度不超过10的字符串,如果有歧义字符就将其修改.输出修改过多少组密码并按输入顺序输出ID和修改后的密码, ...
- PAT (Advanced Level) Practice 1035 Password (20 分)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- 【PAT】1035. Password (20)
题目:http://pat.zju.edu.cn/contests/pat-a-practise/1035 分析:简单题.直接搜索,然后替换,不会超时,但是应该有更好的办法. 题目描述: To pre ...
随机推荐
- python学习第五次笔记
python学习第五次笔记 列表的缺点 1.列表可以存储大量的数据类型,但是如果数据量大的话,他的查询速度比较慢. 2.列表只能按照顺序存储,数据与数据之间关联性不强 数据类型划分 数据类型:可变数据 ...
- 更改Windows更新源(解决公司内部网络无法下载语言包或更新的问题)
打开注册表 找到HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate 将WUServer.WUStatusServe ...
- loadrunner的安装与破解
https://pan.baidu.com/s/1H4Cj0ySTwqPra5OA3nicmw 背景: 由于想做服务器的性能测试,所以最近有意研究一下loadrunner这个工具,下面仅将安装过程做个 ...
- gggg
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Image & Raw Image的区别
一.面板参数 1.Image类型: Source Image:图片资源(sprite) Color:颜色 Material:材质 Raycast Target :是否作为射线目标 Sprite 2D: ...
- Linux恢复误删除的文件或者目录(转)
linux不像windows有个回收站,使用rm -rf *基本上文件是找不回来的. 那么问题来了: 对于linux下误删的文件,我们是否真的无法通过软件进行恢复呢? 答案当然是否定的,对于误删的文件 ...
- vm12pro 安装winxp过程 记录1(涵个人问题)
1.百度的xp资源 选好iso文件后出现如下情景: 2.百度以后是要在一开始的首次界面就选择从哪个盘开始 3.选择了“Windowgs PE”选项…加载出界面后选择了ghost xp…现在…黑屏了…… ...
- Cookie保存用户名和密码
首次登录: 第二次登录: 百度网盘: 链接: https://pan.baidu.com/s/12W4B5-Bfyc_021oyVYkEJw 提取码: r55h
- BZOJ 4265 货币系统
今天比赛的时候做到的.题解写得很简单,但是感觉对于我这种蒟蒻还是很有思考的价值的. 题面(由于题面很短,就不概括了):小Q当上了新的宇宙大总统,他现在准备重新设计一套货币系统. 这个货币系统要求一共有 ...
- linux安装Samba服务
[1].yum -y install samba安装samba [2].找到samba配置文件:vim /etc/samba/smb.conf [3].[gloabl]下面security有三种模式: ...