pat 1035 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 replace1 (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
 1 #include <iostream>
 2 #include <algorithm>
 3 #include <cstdio>
 4 #include <cstring>
 5 #include <map>
 6 #include <stack>
 7 #include <vector>
 8 #include <queue>
 9 #include <set>
10 #define LL long long
11 using namespace std;
12 const int MAX = 20, MAXN = 1e3 + 10;
13 
14 struct node
15 {
16     char s1[MAX], s2[MAX];
17 }P[MAXN];
18 char buf1[MAX], buf2[MAX];
19 int n, cnt = 0;
20 map <char, char> mp;
21 
22 
23 bool is_ans()
24 {
25     bool flag = false;
26     int len = strlen(buf2);
27     for (int i = 0; i < len; ++ i)
28     {
29         if (mp.find(buf2[i]) != mp.end())
30         {
31             buf2[i] = mp[buf2[i]];
32             flag = true;
33         }
34     }
35     if (flag) return true;
36     return false;
37 }
38 
39 int main()
40 {
41 //    freopen("Date1.txt", "r", stdin);
42     mp['l'] = 'L', mp['O'] = 'o', mp['1'] = '@', mp['0'] = '%';
43     scanf("%d", &n);
44     for (int i = 1; i <= n; ++ i)
45     {
46         scanf("%s %s", &buf1, &buf2);
47         if (is_ans())
48         {
49             strcpy(P[cnt].s1, buf1);
50             strcpy(P[cnt ++].s2, buf2);
51         }
52     }
53     if (cnt != 0)
54     {
55         printf("%d\n", cnt);
56         for (int i = 0; i < cnt; ++ i)
57             printf("%s %s\n", P[i].s1, P[i].s2);
58         return 0;
59     }
60     if (n == 1)
61         printf("There is 1 account and no account is modified\n");
62     else
63         printf("There are %d accounts and no account is modified\n", n);
64     return 0;
65 }

 

转载于:https://www.cnblogs.com/GetcharZp/p/9589514.html

DEAP数据集实战指南:从脑电信号到情绪分类的完整流程解析 本文提供了DEAP数据集在脑电信号情绪识别领域的完整实战指南。详细解析了数据下载、结构理解、频带功率特征提取等核心步骤,并演示了如何构建和评估机器学习分类模型,为研究者实现从原始脑电信号到情绪分类的完整流程提供了清晰路径。 阅读详情

相关推荐

Zynq/ZynqMP PL端以太网实战:手把手教你用GMII to RGMII IP和EMIO打通网络(附KSZ9031 PHY驱动修改)

本文详细介绍了在Zynq/ZynqMP平台上使用GMII to RGMII IP核和EMIO接口实现PL端以太网通信的全栈开发流程,特别针对KSZ9031 PHY芯片提供了定制化驱动修改方案。内容涵盖硬件设计、Vivado配置、裸机驱动开发、Linux系统集成及实战调试技巧,帮助开发者高效解决工业控制和边缘计算中的以太网连接问题。

weixin_30642561的博客 582

局域网ntp服务器设置(windows时间同步服务器NetTime)(ubuntu systemd-timesyncd ntp客户端)123端口、ntp校时、ntp同步(设置UDP入站流量绕过防火墙)

"pool.ntp.org"项目使用DNS轮询来分配各种时间服务器的流量,这意味着当你查询"pool.ntp.org"时,DNS服务器会返回该池中任意一个服务器的IP地址。这样,你就把你的Windows主机设为了NTP服务器。然而,如果你的网络不能访问互联网,那么你将无法使用这个地址,因为它需要通过互联网来访问NTP Pool的服务器。值4(二进制100)告诉W32Time服务,只有当本机是一个可靠的时间服务时(例如,它已经被配置为手动同步到一个硬件时钟或外部NTP服务器),才公布自己为时间服务器。

Dontla的博客 2万+

Unable to negotiate with XXXX port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

打开ssh_config此文件,滑动到最下面,新增自己git主机地址(这里我直接默认*)执行命令 git clone git@xxxxxxxxxxxxx.git。代码仓库已经添加了ssh公钥之后,克隆代码到本地时就报了这个问题。首先是找到git安装目录(根据自己安装时选项,找到这个目录)再进入ssh目录,找到 ssh_config 配置文件。配置完成后,保存配置文件后再次去clone代码。直接复制下面这一段到文件中最底部位置即可。然后进入 etc目录,找到ssh目录。终于可以克隆下来了。

萌兔兔MMQ!! 3358

win11指定时间服务器

点击 Internet 时间 ,更改设置,设置时间服务器的地址,保存并立即同步。点击时间和语言 >> 日期和时间。

不积跬步,无以至千里 5568

【锂离子电池力学耦合及相场法模拟技术与应用】

8. 电化学仿真软件的使用与案例分析 (1) 各向异性纳米线锂化应力分析(实例讲解1) (2) 化学反应及死锂现象研究(案例分析2)(3) 锂化循环损伤计算(案例分析3)6. 4. 电池材料的力学与电化学耦合性能分析(1) 耦合效应对电池性能的影响(2) 耦合模型的验证与应。5. 5. 电池颗粒、极片、电芯尺度力-电-化-热多场耦合模型概述力学-7. 颗粒尺度耦合模型在电池失效分析中的应用。2. 2. 电池电极材料的分类与特性。5. (2) 耦合模型的验证与应用。电化学耦合模型与仿真。

weixin_51101456的博客 523

TSP、MTSP问题遗传算法详细解读及python实现

写在前面 遗传算法是一种求解NPC问题的启发式算法,属于仿生进化算法族的一员。仿生进化算法是受生物行为启发而发明的智能优化算法,往往是人们发现某种生物的个体虽然行为较为简单,但生物集群通过某种原理却能表现出智能行为。于是不同的人研究不同的生物行为原理,受到启发而发明出新的仿生进化算法。比如免疫优化算法,蚁群算法,模拟退火算法等,这些算法以后也会简单介绍。 本文的主题是遗传算法,该算法也是受到生物行为启发。物竞天择,适者生存,优胜劣汰,是该优化算法的核心思想。笔者在业务中需要用到遗传算法求解TSP问题,但是网

weixin_47675950的博客 9306

【一键校时】Ntp校时程序

软件功能:测试多个Ntp服务器延迟,进行校时操作,支持自定义Ntp服务器!

qq_67689815的博客 678

SAP产品合规(Product Compliance)管理—规格主数据 CG02/CG02WB

SAP产品合规(Product Compliance)管理—规格主数据概览 CG02/CG02WB

Lucas1211的博客 1430

pat-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...

欢迎访问方偲的博客 388

【Unity的HDRP渲染管线下用Steam VR串流结合使用遇到的各种问题_SteamVR 插件和Pico串流助手】

当你启用"Mock Runtime"选项后,Unity将模拟一个虚拟的OpenXR运行时环境,并提供一些虚拟的设备和功能,让你能够进行开发和调试。在Unity中,SteamVR插件是一个由Valve提供的Unity插件,它允许开发者在Unity项目中集成SteamVR功能,以便支持SteamVR设备。OpenXR是一个跨平台的虚拟和增强现实(VR/AR)开发接口,它为开发者提供了一个统一的接口,用于访问不同VR/AR硬件设备和平台的功能。这个选项是用于模拟OpenXR运行时环境的功能。

暴走约伯的博客 2800

CCP消息格式

CCP消息格式 CCP协议的实现只依赖于两则CAN消息CRO(Command Receive Object)和DTO(Data Transmission Object),CCP消息统一采用8字节数据场,所有命令参数以及数据都被打包在8字节的数据场中。 1、CRO(命令接收对象) CRO是主设备向从设备发送的消息对象,包括命令代码及命令参数,结构如下: CCP一共28条命令,所以命令代码有28个。...

wsq119的博客 1206

关于ntp校时软件windows版本-abouttime的介绍

关于ntp校时软件windows版本-abouttime的介绍 【下载地址】关于ntp校时软件windows版本-abouttime的介绍 AboutTime是一款经典的NTP校时软件,专为Windows系统设计,凭借其卓越的功能和高效性能,深受用户喜爱。它不仅支持作为校时客户端与互联网NTP服务器同步,还能在局域网中充...

gitblog_06717的博客 1004

ESD防护设计宝典(二十三):ESD与EOS失效差异分析

ESD和EOS是电子制造业面临的两大挑战,随着电子产品向更高集成度、更低工作电压和更高工作频率发展,这一问题将更加突出。根据美国军方上世纪八十年代与可靠性分析中心(RAC)共同建立的现场失效返回程序(FFRP)统计数据,产品现场返回中EOS占比高达46%,而ESD仅占6%,另有6%的案例难以区分是EOS还是ESD。

m0_56451176的博客 322

PAT 1035 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 distingui...

peanWang的博客 176

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

PAT 1035 Password(20分)

字符串

cwtnice的博客 911

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

PAT A 甲级 1035 Password (20分)

1036 Boys vs Girls (25分) 吐槽 我的VS中l和1是真的长得一模一样啊。要不是这题简单不用回头改代码,不然我怀疑自己会因为搞不清哪一段是关于l的哪一段是关于1的出错几次。 思路 C++的string里有快乐find函数,直接对四个字符循环搜索找到要替换的替换就行。 题目 This time you are asked to tell the difference betwee...

虚境的博客 414

【PAT 甲级】1035 Password (20 分)

1035Password(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 distingu...

CrystalXueNing的博客 256

PAT 甲级 1035 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 distingu...

小渣渣的博客 301

pat 1035 Password (20分)

字符串模拟题: 注意提议就好了 #include <iostream> using namespace std; #include <vector> int main() { int m; cin >> m; string id, pwd; vector<string> p, I; int cnt = 0; while(m--) { bool flag = false; //记录.

weixin_44110100的博客 236

PAT-A 1035 Password (20 分)

思路:水题,直接做。

qq_38127801的博客 251

PAT A1035 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

weixin_45964844的博客 169

PAT 甲级 1035 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

qq_41001689的博客 187

PAT 甲级 1035 Password (20 分)(简单题)

1035Password(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 ...

蔡军帅 388

PAT 1035 Password (20 分)————Python

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 (

Kinght_123的博客 631

【PAT甲级】1035 Password (20分)

解题过程的小记录,如有错误欢迎指出。 简单题,没时间可以不复习 小导航~题目分析注意点我的解题过程思路bug代码dalao的代码借鉴点 题目分析 注意点 我的解题过程 思路 bug 代码 dalao的代码 全部代码因版权原因不放出来,大家可以自行去柳神博客购买或者参考晴神的上机笔记~ 借鉴点 ...

SpicyChicken的自我修养 328

PAT甲级 1035 Password (20分)

1035 Password (20分) 题目链接:PAT A 1035 题目大意:输入第一行给出一个正整数n,随后n行每行给出用户名和密码(均为不含空格的字符串)。要求统计含有1,0,l,O的字符串的个数,并且将1替换成@,将0替换成%,将l替换成L,将O替换成o。如果没有能够替换的,则输出题目要求输出的句子(如果n等于1,句子中的are应该改为is)。 思路分析:非常简单的一道题,只需要建立...

weixin_43684054的博客 176
上一篇: pat 1050 String Subtraction(20 分)
下一篇: pat 1046 Shortest Distance(20 分) (线段树)
devon2014
博客等级 码龄12年 3粉丝 144原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值