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 ...
随机推荐
- 配置javaBean
bean基本配置: <bean id="exampleBean" class="examples.ExampleBean"></bean> ...
- PostgreSQL角色和权限理解
1.继承的权限只是继承该组的表的权限,用户对应的管理员权限则不会被继承. 2.inherit权限是说本角色是否继承别人的权限,而不是本权限能否被别的角色继承. postgres=# create ...
- Android开发入门要点记录:四大组件
cocos2dx跨平台开发中需要了解android开发,昨天快速的浏览了一本Android开发入门教程,因为之前也似懂非懂的写过Activity,Intent,XML文件,还有里面许多控件甚至编程思想 ...
- vue 兼容360及safari的方法
1. npm install --save-dev babel-polyfill 2. main.js 中 import "babel-polyfill"; 或者: ...
- Appium 并发测试基于unitest
前言: 在回归测试阶段,UI测试,兼容测试是测试的必要步骤.UI自动化的本身是比较冗余的测试,但是换个角度思考,UI自动化同时连接多台设备,那么在回归测试时,在同一个脚本下产生的测试结果是非常有价值的 ...
- 如何在magento添加推荐分类
Magento Featured Category推荐分类模块安装 1.下载Magento Featured Categories Extension,下载地址:http://www.storefro ...
- 好玩的Python库tqdm (转载)
原文地址: https://blog.csdn.net/zejianli/article/details/77915751 可以显示循环的进度条的库,再也不用担心不知道程序跑到哪里还要跑多久了 tqd ...
- HOG+SVM+INRIAPerson数据集代码
#include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgu ...
- HDOJ 1061 Rightmost Digit
找出数学规律 原题: Rightmost Digit Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Ja ...
- C#Delegate.Invoke、Delegate.BeginInvoke And Control.Invoke、Control.BeginInvoke
作者:EasonLeung 一.Delegate的Invoke.BeginInvoke 1.Delegate.Invoke (委托同步调用) a.委托的Invoke方法,在当前线程中执行委托. b.委 ...