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
分析:水题
/** * Copyright(c) * All rights reserved. * Author : Mered1th * Date : 2019-02-24-21.10.57 * Description : A1035 */ #include<cstdio> #include<cstring> #include<iostream> #include<cmath> #include<algorithm> #include<string> #include<unordered_set> #include<map> #include<vector> #include<set> using namespace std; struct Node{ string id; string password; }node[]; vector<Node> ans; int main(){ #ifdef ONLINE_JUDGE #else freopen("1.txt", "r", stdin); #endif ; cin>>n; ;i<n;i++){ bool flag=false; cin>>node[i].id>>node[i].password; int len=node[i].password.size(); ;j<len;j++){ '){ node[i].password[j]='@'; flag=true; } '){ node[i].password[j]='%'; flag=true; } else if(node[i].password[j]=='l'){ node[i].password[j]='L'; flag=true; } else if(node[i].password[j]=='O'){ node[i].password[j]='o'; flag=true; } } if(flag) { num++; ans.push_back(Node{node[i].id,node[i].password}); } } ){ printf("%d\n",num); ;i<ans.size();i++){ cout<<ans[i].id<<" "<<ans[i].password<<endl; } } ){ ){ printf("There is 1 account and no account is modified\n"); } else{ printf("There are %d accounts and no account is modified\n",n); } } ; }
1035 Password (20 分)的更多相关文章
- PAT 甲级 1035 Password (20 分)(简单题)
1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for ...
- PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...
- 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 分)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- 1035 Password (20分)(水)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- 【PAT甲级】1035 Password (20 分)
题意: 输入一个正整数N(<=1000),接着输入N行数据,每行包括一个ID和一个密码,长度不超过10的字符串,如果有歧义字符就将其修改.输出修改过多少组密码并按输入顺序输出ID和修改后的密码, ...
- 【PAT】1035. Password (20)
题目:http://pat.zju.edu.cn/contests/pat-a-practise/1035 分析:简单题.直接搜索,然后替换,不会超时,但是应该有更好的办法. 题目描述: To pre ...
- 1035 Password (20)
#include <stdio.h> #include <string.h> struct MyStruct { ]; ]; bool changed; }; int main ...
- 1035 Password (20)(20 point(s))
problem To prepare for PAT, the judge sometimes has to generate random passwords for the users. The ...
随机推荐
- Python 数值计算库之-[Pandas](六)
- 安装win8时提不能在gpt磁盘中安装
首先,你要知道,GPT和NTFS根本就是两码事儿.所谓的GPT,是指可扩展固件接口 (EFI) 使用的磁盘分区架构,是与主启动记录 (MBR) 分区架构相对应的,是一种磁盘分区架构.而ntfs,fat ...
- SOD范例
SOD申请台站波形数据范例: <?xml version="1.0"?> <sod> <eventArm> <fdsnEvent> ...
- Tesseract-OCR 训练教程(一)
实际应用中[font]替换为你自己的字体名,比如newfont.hehe等 1.根据tif生成box文件(位置宽高等信息)tesseract [font].font.exp0.tif [font].f ...
- JDK安装和环境变量配置-成功经验
JDK安装和环境变量配置1.下载安装软件 2.安装JDK--开发环境,路径 3.之后打开安装路径下的bin文件夹路径,我的是默认安装C:\Program Files\Java\jdk1.6.0_10\ ...
- E - An Awful Problem 求两段时间内满足条件的天数//lxm
In order to encourage Hiqivenfin to study math, his mother gave him a sweet candy when the day of th ...
- stm32 SPI介绍和配置
SPI是一种高速的,全双工同步的通信总线,在芯片管脚上占用了四根线,节约了芯片的管脚,同时为PCB的布局节省了空间,提供了方便,因此越来越多的芯片集成了这种通信协议,STM32也就有了SPI接口. 有 ...
- ZOJ 3211dream city dp(效率优化)
Dream City Time Limit: 1 Second Memory Limit:32768 KB JAVAMAN is visiting Dream City and he see ...
- SUST OJ 1674: 入侵与反击(最长不下降子序列)
1674: 入侵与反击 时间限制: 1 Sec 内存限制: 128 MB提交: 229 解决: 28[提交][状态][讨论版] 题目描述 A国部署的反导系统遇到了一个致命BUG,那就是每一次发射的 ...
- 有向图与无向图的合并操作区别D(递归与并查集)
有向图的合并,典型问题:通知小弟(信息只能单向传播)https://www.nowcoder.com/acm/contest/76/E 无向图的合并,典型问题:修道路问题 由于无向图只要二者有联系即可 ...