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 (≤), 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
题目分析:水题 细心就好
#define _CRT_SECURE_NO_WARNINGS
#include <climits>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
struct S {
string s1, s2;
};
vector<S> V;
int main()
{
int N;
cin >> N;
string s1, s2;
for (int i = ; i < N; i++)
{
int flag = ;
cin >> s1 >> s2;
for (int j = ; j < s2.length(); j++)
{
if (s2[j] == '')
{
flag = ;
s2[j] = '@';
}
else if (s2[j] == '')
{
flag = ;
s2[j] = '%';
}
else if (s2[j] == 'l')
{
flag = ;
s2[j] = 'L';
}
else if (s2[j] == 'O')
{
flag = ;
s2[j] ='o';
}
}
if (flag)
V.push_back({ s1,s2 });
}
if (V.size() == )
{
if (N == )
cout << "There is 1 account and no account is modified";
else
printf("There are %d accounts and no account is modified", N);
}
else
{
cout << V.size() << endl;
for (auto it : V)
cout << it.s1 << " " << it.s2<<endl;
}
}
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 ...
- 【PAT甲级】1035 Password (20 分)
题意: 输入一个正整数N(<=1000),接着输入N行数据,每行包括一个ID和一个密码,长度不超过10的字符串,如果有歧义字符就将其修改.输出修改过多少组密码并按输入顺序输出ID和修改后的密码, ...
- PAT甲题题解-1035. Password (20)-水
题意:给n个用户名和密码,把密码中的1改为@,0改为%,l改为L,O改为o. 让你输出需要修改密码的用户名个数,以及对应的用户名和密码,按输入的顺序.如果没有用户需要修改,则输出对应的语句,注意单复数 ...
- 【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 ...
随机推荐
- 看完这篇 HTTPS,和面试官扯皮就没问题了
下面我们来一起学习一下 HTTPS ,首先问你一个问题,为什么有了 HTTP 之后,还需要有 HTTPS ?我突然有个想法,为什么我们面试的时候需要回答标准答案呢?为什么我们不说出我们自己的想法和见解 ...
- Simulink仿真入门到精通(十二) Publish发布M文件
12.1 M文件的注释 使用%进行注释. 连续多行注释Ctrl+R,取消注释Ctrl+T. 12.2 Cell模式 在MATLAB脚本文件中使用连续两个注释符,开启一个新的Cell块,%%后空一格追加 ...
- linux ftp服务器设置,只允许用户访问指定的文件夹,禁止访问其他文件夹
在Linux中添加ftp用户,并设置相应的权限,操作步骤如下: 1.环境:ftp为vsftp.被限制用户名为test.被限制路径为/home/test 2.建用户:在root用户下: useradd ...
- c js 字符串反转
1.例如:输入 i am a student 输出 student a am i #include <stdio.h> #include <string.h> v ...
- Java并发编程学习前期知识下篇
Java并发编程学习前期知识下篇 通过上一篇<Java并发编程学习前期知识上篇>我们知道了在Java并发中的可见性是什么?volatile的定义以及JMM的定义.我们先来看看几个大厂真实的 ...
- 【Weiss】【第03章】练习3.25:数组模拟队列
[练习3.25] 编写实现队列的例程,使用 a.链表 b.数组 Answer: 在这章一开头就已经写了个链表的队列例程了,所以实际上只要做b小题就可以. 数组模拟队列和链表的两点小不同是: ①.数组空 ...
- 懂一点Python系列——快速入门
本文面相有 一定编程基础 的朋友学习,所以略过了 环境安装.IDE 搭建 等一系列简单繁琐的事情. 一.Python 简介 Python 英文原意为 "蟒蛇",直到 1989 年荷 ...
- Journal of Proteome Research | SAAVpedia: identification, functional annotation, and retrieval of single amino acid variants for proteogenomic interpretation | SAAV的识别、功能注释和检索 | (解读人:徐洪凯)
文献名:SAAVpedia: identification, functional annotation, and retrieval of single amino acid variants fo ...
- ICML 2019论文录取Top100:谷歌霸榜
[导读]人工智能顶级会议ICML 2019发布了今年论文录取结果.提交的3424篇论文中,录取了774篇,录取率为22.6%,较去年有所降低.从录取论文数量来看,谷歌成为今年最大赢家,紧随其后的是MI ...
- LeetCode#1047-Remove All Adjacent Duplicates In String-删除字符串中的所有相邻重复项
一.题目 给出由小写字母组成的字符串 S,重复项删除操作会选择两个相邻且相同的字母,并删除它们. 在 S 上反复执行重复项删除操作,直到无法继续删除. 在完成所有重复项删除操作后返回最终的字符串.答案 ...