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 ...
随机推荐
- ant 打 jar 包添加 manifest.mf 文件
经查询 ant 有 <manifest> 任务可以创建 manifest文件(https://ant.apache.org/manual/Tasks/manifest.html) 但尝试在 ...
- MyEclipse WebSphere开发教程:安装和更新WebSphere 6.1, JAX-WS, EJB 3.0(六)
[周年庆]MyEclipse个人授权 折扣低至冰点!立即开抢>> [MyEclipse最新版下载] MyEclipse支持Java EE技术(如JAX-WS和EJB 3.0),它们以功能包 ...
- koa 核心源码介绍
链接来源 Request,Context,Response 在代码运行之前就已经存在的 Request和Response自身的方法会委托到Context中. Context源码片段 var dele ...
- 移动端js模拟截屏生成图片并下载功能的实现方案
一.根据PM需求如下: 移动端wap 实现将二维码生成图片下载至用户手机相册保存 二.根据现有思路: 1.使用第三方工具html2canvas,将页面中指定范围的dom转换为canvas 2.随后使用 ...
- OK335xS U-boot 环境变量解析
/************************************************************************************************** ...
- IO练习--按字节截取字符串
* 在Java中字符串“abcd”和字符串“ab你好”都是4个字符, * 但是字节数不同,因为GBK中一个汉字占两个字节 * 定义一个方法用来按字节数截取字符串. * 如:对于“ab你好”,取3个字节 ...
- Hadoop storm大数据分析 知识体系结构
最近工作工作有用到hadoop 和storm,最近看到一个网站上例句的hadoop 和storm的知识体系.所以列出来供大家了解和学习.来自哪个网站就不写了以免以为我做广告额. 目录结构知识点还是挺全 ...
- memsql 6.7集群安装
预备环境处理 安装yum 源 yum install -y yum-utils yum-config-manager --add-repo https://release.memsql.com/pro ...
- oclif cli app开发简单试用
oclif 是heroku 开源的cli 开发框架,有一篇关于12 factor cli app 开发的文章很值得看看 https://medium.com/@jdxcode/12-factor-cl ...
- Oracle删除归档文件
归档文件过大,会导致数据库出现异常,无法登陆. 1.D盘下新建一个delete_arch.txt文件 connect target / run { DELETE ARCHIVELOG ALL COMP ...