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 分)的更多相关文章

  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. 1035 Password (20分)(水)

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

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

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

  8. 【PAT】1035. Password (20)

    题目:http://pat.zju.edu.cn/contests/pat-a-practise/1035 分析:简单题.直接搜索,然后替换,不会超时,但是应该有更好的办法. 题目描述: To pre ...

  9. 1035 Password (20)

    #include <stdio.h> #include <string.h> struct MyStruct { ]; ]; bool changed; }; int main ...

  10. 1035 Password (20)(20 point(s))

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

随机推荐

  1. DevExpress v18.1新版亮点——WinForms篇(七)

    用户界面套包DevExpress v18.1日前终于正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了DevExpress WinForms v18.1 的新功能,快来下载试用新版本! ...

  2. (转)git合并多个commit

    原文地址:http://platinhom.github.io/2016/01/02/git-combine_commit/ 有时commit多了看着会不爽.所以想合并掉一些commit. 这里是最简 ...

  3. L232 No methane on Mars

    On earth, most of the methane in the atmosphere has been belched by living organisms, so finding the ...

  4. 多种数据库之间的同步工具SymmetricDS

    代码:https://github.com/JumpMind/symmetric-ds 原理: 通过触发器模式同步时,是将数据库的变化记录到某个系统表中,然后在客户端建立缓冲,并定期将变化push到接 ...

  5. 想ACCESS数据库插入新的用户

    public string AddUserN = ""; //定义用户名字符串 public string paswrd1 = ""; //密码1 public ...

  6. ModuleNotFoundError: No module named '_tkinter'

    https://blog.csdn.net/blueheart20/article/details/78763208 apt search python3-tk apt install python3 ...

  7. java 百分比显示Double类型数值

    DecimalFormat percent = new DecimalFormat("0.00%"); completed_num = (double) involvedTask_ ...

  8. scanf格式化中的\n

    如果一个scanf的格式串以\n结尾,那么在读取完后还会阻塞等待,比如: int a; scanf("%d\n", &a); 这种情况,输入一个数字然后敲下回车后,程序还是 ...

  9. vue 钩子

    生命周期总结 这么多钩子函数,我们怎么用呢,我想大家可能有这样的疑问吧,我也有,哈哈哈. beforecreate : 举个栗子:可以在这加个loading事件 created :在这结束loadin ...

  10. 杭电oj2001-C语言

    题目 题目 Problem Description 输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离. Input 输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x ...