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
 #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <stack>
#include <vector>
#include <queue>
#include <set>
#define LL long long
using namespace std;
const int MAX = , MAXN = 1e3 + ; struct node
{
char s1[MAX], s2[MAX];
}P[MAXN];
char buf1[MAX], buf2[MAX];
int n, cnt = ;
map <char, char> mp; bool is_ans()
{
bool flag = false;
int len = strlen(buf2);
for (int i = ; i < len; ++ i)
{
if (mp.find(buf2[i]) != mp.end())
{
buf2[i] = mp[buf2[i]];
flag = true;
}
}
if (flag) return true;
return false;
} int main()
{
// freopen("Date1.txt", "r", stdin);
mp['l'] = 'L', mp['O'] = 'o', mp[''] = '@', mp[''] = '%';
scanf("%d", &n);
for (int i = ; i <= n; ++ i)
{
scanf("%s %s", &buf1, &buf2);
if (is_ans())
{
strcpy(P[cnt].s1, buf1);
strcpy(P[cnt ++].s2, buf2);
}
}
if (cnt != )
{
printf("%d\n", cnt);
for (int i = ; i < cnt; ++ i)
printf("%s %s\n", P[i].s1, P[i].s2);
return ;
}
if (n == )
printf("There is 1 account and no account is modified\n");
else
printf("There are %d accounts and no account is modified\n", n);
return ;
}

pat 1035 Password(20 分)的更多相关文章

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

    1035 Password (20 分)   To prepare for PAT, the judge sometimes has to generate random passwords for ...

  2. PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...

  3. PAT甲级——1035 Password (20分)

    To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...

  4. PAT Advanced 1035 Password (20 分)

    To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...

  5. PAT (Advanced Level) Practice 1035 Password (20 分)

    To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...

  6. 【PAT甲级】1035 Password (20 分)

    题意: 输入一个正整数N(<=1000),接着输入N行数据,每行包括一个ID和一个密码,长度不超过10的字符串,如果有歧义字符就将其修改.输出修改过多少组密码并按输入顺序输出ID和修改后的密码, ...

  7. 1035 Password (20分)(水)

    To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...

  8. PAT 1035 Password

    1035 Password (20 分)   To prepare for PAT, the judge sometimes has to generate random passwords for ...

  9. PAT 1035 Password [字符串][简单]

    1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for th ...

随机推荐

  1. 01--Java语言概述与开发环境 最适合入门的Java教程

    Java 程序运行机制 编译型语言: 使用专门的编译器,针对特定平台(操作系统)将某种高级语言源代码一次性"翻 译"成可被该平台硬件执行的机器码(包括机器指令和操作数),并包装成该 ...

  2. CodeForces - 1214D D. Treasure Island

    题目链接:https://vjudge.net/problem/2728294/origin 思路:可以抽象成管道,先试试能不能找到一个通道能通到终点, 如果可以则封锁这个通道,一个石头即可, 再试试 ...

  3. C# 添加、修改、删除Excel图表数据标签

    图表中,图表数据标签以数据化形式表现图表中的特定数据,可增强图表的可读性.我们可以对图表添加数据标签,也可以对已有的数据标签进行修改或者删除,下面将通过C#代码形式来实现. 使用工具:Spire.XL ...

  4. MD5收集整理

    MD5如何生成的 百度百科 生成MD5 1.通过摘要生成MD5 MessageDigest md = MessageDigest.getInstance("MD5"); md.up ...

  5. IntelliJ IDEA 2019.2最新版本免费激活码

    IntelliJ IDEA 2019.2最新版本免费激活码 支持IDEA所有版本 正版授权激活码 今天更新了一下,支持java13等新功能.下面是激活码 812LFWMRSH-eyJsaWNlbnNl ...

  6. Java源码 HashMap.roundUpToPowerOf2原理

    int rounded = number >= MAXIMUM_CAPACITY ? MAXIMUM_CAPACITY : (rounded = Integer.highestOneBit(nu ...

  7. oc基本知识

    (一)构造函数 h文件 #import <Foundation/Foundation.h> @interface Student : NSObject { NSString *_name; ...

  8. C#开发命令执行驱动程序 之 控制标志的命令行参数

    /// <summary> /// 在cmd窗体内执行如下: /// CtrlOrderDrierApp.exe -f -t /// 返回: /// FOO /// Show Table ...

  9. SpringBoot中教你手把手配置 https

    升级 https 记录 1.去阿里云购买证书(免费版),并提交审核资料 购买的证书 2.下载证书 下载证书 3.查看上图页面的第三步 JKS证书安装 4.在证书目录下执行阿里云提供的命令,密码都填 p ...

  10. Ajax自我总结

    一念起.万水千山皆有情. 一念灭.沧海桑田已无心.     ------ 随记 本文主要针对ajax原理介绍,很少涉及实例,主要用于对知识的梳理总结,方便以后学习和查询... Ajax 一.Ajax是 ...