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 ...
随机推荐
- JS中的reduce()详解
reduce()作为一个循环使用.接收四个参数:初始值(上一次返回值),当前元素值,当前元素下标,原数组. 应用 作为累加器使用 var a=[4,5,6,7,8] //item代表一次回调的值 初 ...
- linux 读取 USB HID鼠标坐标和点击 在 LCD上显示
首先要,编译内核时启用了 USB HID 设备.启用了 鼠标 . 在开发板上插入usb 时会有如下提示. 可以看到,多了一个 mouse0 和 eventX 打出来的是我的 联想鼠标. 1, 在 终端 ...
- 一文掌握Redis的三种集群方案
在开发测试环境中,我们一般搭建Redis的单实例来应对开发测试需求,但是在生产环境,如果对可用性.可靠性要求较高,则需要引入Redis的集群方案.虽然现在各大云平台有提供缓存服务可以直接使用,但了解一 ...
- Python——项目-小游戏
开始我们的项目 飞机大战 1 项目的初体验 以及前期准备 游戏初体验画面 验证一下本地第三方包有没有导入 python3 -m pygame.examples.aliens 如果没有出现游戏画面请先安 ...
- Visual Studio 安装中出现闪退
问题描述:win7 系统下, 安装 Visual Studio Community 2017 过程中,安装界面闪退 原因:Visual Studio 的版本低了 解决方案:选择 Visual Stud ...
- RPA如何跑赢传统自动化和人工?
过去的4年时间里,RPA(机器人流程自动化)一词,在Gartner的搜索引擎中一直排名前五.去年Gartner发表的调查数据中显示,RPA行业在2018年保持了60%以上的增长速度,从而成为全球增长最 ...
- inspect的使用安卓动态分析工具
一.安装步骤 1.安装xposed 2.安装inspect 二.inspect 一个基于Xposed 开发的应用动态分析工具 github已开源 内置web页面 体验度很不错 ‘ 核心功能 监控Sha ...
- Gorm 预加载及输出处理(二)- 查询输出处理
上一篇<Gorm 预加载及输出处理(一)- 预加载应用>中留下的三个问题: 如何自定义输出结构,只输出指定字段? 如何自定义字段名,并去掉空值字段? 如何自定义时间格式? 这一篇先解决前两 ...
- 关于Addressable的疑问
1)关于Addressable的疑问2)Addressable如何进行热更新3)如何设置SceneView相机的Shader变量4)Activity默认为SingleTask的原因5)关于Resour ...
- 在MacOS上利用docker构建buildroot
之前有听说过docker,但是一直没有使用过.最近终于下定决定使用了一下docker,感觉docker用于跨操作系统的软件工具使用还是比较友好的. 适用人群 本文忽略的部分Linux软件包安装的过程, ...