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& ...
随机推荐
- UML核心元素--用例
定义:用例定义了一组用例实例,其中每个实例都是系统所执行的一些列操作,这些操作生成特定主角可以观测的值.一个完整的用例定义由参与者.前置条件.场景.后置条件构成. 1.理解用例:用例就是参与者希望通过 ...
- 转载:Android Studio调试功能使用总结
这段时间一直在使用Intellij IDEA, 今天把调试区工具的使用方法记录于此. 先编译好要调试的程序. 1.设置断点 选定要设置断点的代码行,在行号的区域后面单击鼠标左键即可. 2.开启调试会话 ...
- sort,uniq,cut,wc命令详解
sortsort 命令对 File 参数指定的文件中的行排序,并将结果写到标准输出.如果 File 参数指定多个文件,那么 sort 命令将这些文件连接起来,并当作一个文件进行排序. sort语法 s ...
- call apply bind 的区别
1.call和apply都是对函数的直接调用,而bind方法返回的仍然是一个函数,因此后面还需要()来进行调用才可以 var xw={ name: "小王", gender: &q ...
- Springboot ResponseEntity IE无法正常下载文件
项目在google浏览器下都很nice了,但当测试到IE的时候开始出现各种问题. 项目是前端js通过URL传参fileName到后台解析返回ResponseEntity 前端代码如下: window. ...
- 1.3 xss原理分析与剖析(4)
0×01 URL编码 URL只允许用US-ASCII字符集中可打印的字符(0×20—0x7x),其中某些字符在HTTP协议里有特殊的意义,所以有些也不能使用.这里有个需要注意的,+加号代表URL编码的 ...
- Python开发【第二篇】: 基本数据类型(一)
1. 整型 整型即整数,用 int 表示,在 Python3 中整型没有长度限制. 1.1 内置函数 1. int(num, base=None) int( ) 函数用于将字符串转换为整型 ...
- 【service调用dao层传参的三种方式】
第一种方案:默认数组角标: service Public User selectUser(String name,String area); mapper: <select id="s ...
- .net core 深入了解配置文件加载过程
前言 配置文件中程序运行中,担当着不可或缺的角色:通常情况下,使用 visual studio 进行创建项目过程中,项目配置文件会自动生成在项目根目录下,如 appsettings.json, ...
- CentOS6.5内核升级FATAL: Module scsi_wait_scan not found
系统为CentOS6.5的虚拟机内核升级至版本4.6.0-1,重启后,报以下错误: Module scsi_wait_scan not found. 无法进入系统. 问题描述详见:Known Issu ...