pat1035. 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 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
- #include<cstdio>
- #include<stack>
- #include<algorithm>
- #include<iostream>
- #include<stack>
- #include<set>
- #include<map>
- #include<vector>
- using namespace std;
- vector<string> v;
- map<string,string> ha;
- bool check(char &c){
- if(c==''){
- c='@';
- return true;
- }
- if(c==''){
- c='%';
- return true;
- }
- if(c=='l'){
- c='L';
- return true;
- }
- if(c=='O'){
- c='o';
- return true;
- }
- return false;
- }
- int main(){
- //freopen("D:\\INPUT.txt","r",stdin);
- int n;
- scanf("%d",&n);
- int i,j;
- string num,pas;
- int count=;
- for(i=;i<n;i++){
- cin>>num>>pas;
- bool can=false;
- for(j=;j<pas.length();j++){
- if(check(pas[j])){
- can=true;
- }
- }
- if(can){
- count++;
- v.push_back(num);
- ha[num]=pas;
- }
- }
- if(count){
- printf("%d\n",count);
- for(j=;j<v.size();j++){
- cout<<v[j]<<" "<<ha[v[j]]<<endl;
- }
- }
- else{
- if(n==){
- printf("There is 1 account and no account is modified\n",n);
- }
- else{
- printf("There are %d accounts and no account is modified\n",n);
- }
- }
- return ;
- }
pat1035. Password (20)的更多相关文章
- PAT1035: Password
1035. Password (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare f ...
- A1035 Password (20)(20 分)
A1035 Password (20)(20 分) To prepare for PAT, the judge sometimes has to generate random passwords f ...
- 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 ...
- 1035 Password (20)
#include <stdio.h> #include <string.h> struct MyStruct { ]; ]; bool changed; }; int main ...
- 【PAT】1035. Password (20)
题目:http://pat.zju.edu.cn/contests/pat-a-practise/1035 分析:简单题.直接搜索,然后替换,不会超时,但是应该有更好的办法. 题目描述: To pre ...
- 1035 Password (20)(20 point(s))
problem To prepare for PAT, the judge sometimes has to generate random passwords for the users. The ...
- PAT A1035 Password (20)
AC代码 注意创造函数条件中使用引用 输出语句注意单复数 #include <cstdio> #include <cstring> #include <iostream& ...
随机推荐
- 人物-IT-雷军:雷军
ylbtech-人物-IT-雷军:雷军 雷军 (全国工商联副主席,小米科技创始人.董事长) 雷军,1969年12月16日出生于湖北仙桃,毕业于武汉大学,是中国大陆著名天使投资人. 雷军作为中国互联网 ...
- HTTP 2 VS HTTP 1.1
提升H5应用加载速度的方式有很多,比如缓存.cdn加速.代码压缩合并和图片压缩等技术. 今天介绍的是HTTP 2.0
- 网络编程之socket编程实例
简单实例1 server.c #include <stdio.h> #include <string.h> #include <stdlib.h> #include ...
- 选择炸了(JIRA)的88个
作者:Martin Seibert SEIBERT MEDIA 首席执行官. 原文地址:http://seibert.biz/jirareasons 作者Martin Seibert 是德国互联网代理 ...
- C++类和对象的一个简单的实例
题目:找出一个整形数组中的元素的最大值 下面,我们用类和对象的方法来做. #include<iostream> using namespace std; class Array_max{ ...
- WPF TextBox 多行时回车换行
<Setter Property="TextWrapping" Value="Wrap"></Setter> <Setter Pr ...
- JS中双击和单击事件冲突解决
在JS中代码中同一功能块中通常同时会用到单击.双击事件,但通常会遇到一个问题,就是在双击的时候即执行了一次双击事件,而且还执行了两次单击事件.此类冲突在ZTree.DHTMLX中经常遇到. 想要解决两 ...
- SPOJ - REPEATS Repeats (后缀数组+RMQ)
题意:求一个串中出现重复子串次数最多的数目. 析:枚举每个长度的子串,至少要重复两次,必然会经过s[l*i]中相邻的两个,然后再分别向前和向后匹配即可. 代码如下: #pragma comment(l ...
- android build system resource links
总体结构,参见这里:http://www.jayway.com/2012/10/24/a-practical-approach-to-the-aosp-build-system/ 一般应用的Andro ...
- vue -- 插件的开发与使用
开发插件 插件通常会为 Vue 添加全局功能.插件的范围没有限制--一般有下面几种: 1.添加全局方法或者属性,如: vue-custom-element. 2.添加全局资源:指令/过滤器/过渡等,如 ...