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. DevExpress v17.2新版亮点——CodeRush篇(二)

    用户界面套包DevExpress v17.2日前终于正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了CodeRush v17.2 的新功能,快来下载试用新版本! 支持XAML 标记扩 ...

  3. jQuery之阻止默认事件以及解除阻止

    大家都知道e.preventDefault()可以阻止默认时间,例如提交功能,但是怎么解除呢?以下参考于网络: 可以使用removeEventListener来移除.但是条件是addEventList ...

  4. NBUT 1223 Friends number 2010辽宁省赛

    Time limit  1000 ms Memory limit   131072 kB Paula and Tai are couple. There are many stories betwee ...

  5. 测试JS方法运行时间

    console.time(label) 和 console.timeEnd(label), 在开始的地方写上 console.time("测试 fn 速度: ") ,在结束的地方写 ...

  6. QList 列表指针的 释放

    1,使用qDeleteAll() QList<T*> list: qDeleteAll(list): list = NULL; QList<T*> *listp: qDelet ...

  7. CTC+pytorch编译配置warp-CTC

    CTC CTC可以生成一个损失函数,用于在序列数据上进行监督式学习,不需要对齐输入数据及标签,经常连接在一个RNN网络的末端,训练端到端的语音和文本识别系统.CTC论文地址:http://www.cs ...

  8. Android Gradle 理解

    /********************************************************************************* * Android Gradle ...

  9. HDU 1084:What Is Your Grade?

    Problem Description "Point, point, life of student!" This is a ballad(歌谣)well known in col ...

  10. Fzu软工第一次作业-准备篇

    (0)一些想说的话 我叫陈浩,是16级计算机一个很普通的学生.我是补选选软工实践这门课的.选软工实践这门课我想了很久.因为学长学姐告诉我这是一门很锻炼人又很辛苦的课程,需要大量的时间和精力.然而如今的 ...