pat1035. Password (20)
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<cstdio>
#include<stack>
#include<algorithm>
#include<iostream>
#include<stack>
#include<set>
#include<map>
#include<vector>
using namespace std;
vector<string> v;
map<string,string> ha;
bool check(char &c){
if(c==''){
c='@';
return true;
}
if(c==''){
c='%';
return true;
}
if(c=='l'){
c='L';
return true;
}
if(c=='O'){
c='o';
return true;
}
return false;
}
int main(){
//freopen("D:\\INPUT.txt","r",stdin);
int n;
scanf("%d",&n);
int i,j;
string num,pas;
int count=;
for(i=;i<n;i++){
cin>>num>>pas;
bool can=false;
for(j=;j<pas.length();j++){
if(check(pas[j])){
can=true;
}
}
if(can){
count++;
v.push_back(num);
ha[num]=pas;
}
}
if(count){
printf("%d\n",count);
for(j=;j<v.size();j++){
cout<<v[j]<<" "<<ha[v[j]]<<endl;
}
}
else{
if(n==){
printf("There is 1 account and no account is modified\n",n);
}
else{
printf("There are %d accounts and no account is modified\n",n);
}
}
return ;
}
pat1035. Password (20)的更多相关文章
- PAT1035: Password
1035. Password (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare f ...
- A1035 Password (20)(20 分)
A1035 Password (20)(20 分) To prepare for PAT, the judge sometimes has to generate random passwords f ...
- 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 ...
- 1035 Password (20)
#include <stdio.h> #include <string.h> struct MyStruct { ]; ]; bool changed; }; int main ...
- 【PAT】1035. Password (20)
题目:http://pat.zju.edu.cn/contests/pat-a-practise/1035 分析:简单题.直接搜索,然后替换,不会超时,但是应该有更好的办法. 题目描述: To pre ...
- 1035 Password (20)(20 point(s))
problem To prepare for PAT, the judge sometimes has to generate random passwords for the users. The ...
- PAT A1035 Password (20)
AC代码 注意创造函数条件中使用引用 输出语句注意单复数 #include <cstdio> #include <cstring> #include <iostream& ...
随机推荐
- JavaScript-Tool:jquery.cookie.js
ylbtech-JavaScript-Tool:jquery.cookie.js 1.返回顶部 1.jquery.cookie.js /*! * jQuery Cookie Plugin v1.4.0 ...
- centos7 查看启动ntp服务命令
标签(空格分隔): centos7 系统 1. 查看ntp服务命令: [root@node1 ~]# systemctl status ntpd * ntpd.service - Network Ti ...
- Struts学习总结 学习
ContextMap 包含值栈包含 root(list结构)和context(map结构) 值栈包含contextMap的引用. Actioncontext是工具类 可以获取他们 Struts2拥 ...
- sklearn有关参数
from sklearn import datasets from sklearn.linear_model import LinearRegression import matplotlib.pyp ...
- 7.24实习培训日志-Docker-Compose
Docker-Compose 对于昨天的考试,需要 项目根目录下需要docker/mysql/Dockerfile 文件用于构建mysql镜像 项目根目录下需要docker/java/Dockerfi ...
- scrollView用法
在这里记下UIScrollView的用法,一来防止自己忘记,而来再通过这个回顾一下,发现一些新细节. UIScrollView的主要问题在布局上,我现在只用到了内容大小固定额也就是不是tableVie ...
- 深入浅出HTML PDF扫描版
<深入浅出HTML>是一部讲述现代Web标准的优秀教程,彻底摒弃了过时的内容,始终贯彻三层分离的思想.书中结合实例讲述如何使用HTML.CSS设计符合现代Web标准的网页,并讲解了如何使用 ...
- asp.net 防止二次提交 以及UseSubmitBehavior属性-转
页面上有一个按钮,点击之后提交表单,如果什么都不管的话,用户可以在服务器响应完成之前再次点击,这样就出现了二次提交,后果可大可小. 那么我们应该防止二次点击,就要在用户点第一次之后马上Disable这 ...
- SQL Server 2012安装——.net framework 3.5离线安装
前言 电脑用着一直很不舒服,所以就决定对电脑重新配置一番,在装数据库这里,可谓是屡装屡败.自己感觉太麻烦了,于是每次数据库装失败后,就重装系统,然后配置上网文档,这样一来,弄得自己挺恶心,这次很明显成 ...
- 洛谷P1164 小A点菜(01背包求方案数)
P1164 小A点菜 题目背景 uim神犇拿到了uoi的ra(镭牌)后,立刻拉着基友小A到了一家……餐馆,很低端的那种. uim指着墙上的价目表(太低级了没有菜单),说:“随便点”. 题目描述 不过u ...