【PAT甲级】1035 Password (20 分)
题意:
输入一个正整数N(<=1000),接着输入N行数据,每行包括一个ID和一个密码,长度不超过10的字符串,如果有歧义字符就将其修改。输出修改过多少组密码并按输入顺序输出ID和修改后的密码,如果没有修改过就输出There are N accounts and no account is modified。(根据样例如果N==1,are改成is并且accounts不加s)
AAAAAccepted code:
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
char s[][];
char x[][];
int ans[];
int main(){
int n;
cin>>n;
int cnt=;
for(int i=;i<=n;++i){
cin>>x[i];
cin>>s[i];
int flag=;
for(int j=;s[i][j]!=;++j)
if(s[i][j]=='')
s[i][j]='@',flag=;
else if(s[i][j]=='')
s[i][j]='%',flag=;
else if(s[i][j]=='l')
s[i][j]='L',flag=;
else if(s[i][j]=='O')
s[i][j]='o',flag=;
if(flag)
ans[++cnt]=i;
}
if(!cnt&&n==)
cout<<"There is "<<n<<" account and no account is modified";
else if(!cnt&&n>)
cout<<"There are "<<n<<" accounts and no account is modified";
else{
cout<<cnt<<"\n";
for(int i=;i<=cnt;++i)
cout<<x[ans[i]]<<" "<<s[ans[i]]<<"\n";
}
return ;
}
【PAT甲级】1035 Password (20 分)的更多相关文章
- PAT 甲级 1035 Password (20 分)(简单题)
1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for ...
- PAT甲级——1035 Password (20分)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- PAT Advanced 1035 Password (20 分)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- 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 分)
1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for th ...
- PAT 甲级 1077 Kuchiguse (20 分)(简单,找最大相同后缀)
1077 Kuchiguse (20 分) The Japanese language is notorious for its sentence ending particles. Person ...
- PAT 甲级 1061 Dating (20 分)(位置也要相同,题目看不懂)
1061 Dating (20 分) Sherlock Holmes received a note with some strange strings: Let's date! 3485djDk ...
- PAT (Advanced Level) Practice 1035 Password (20 分)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- 【PAT】1035. Password (20)
题目:http://pat.zju.edu.cn/contests/pat-a-practise/1035 分析:简单题.直接搜索,然后替换,不会超时,但是应该有更好的办法. 题目描述: To pre ...
随机推荐
- vue 一些学习笔记
var, let, const 区别 //-----------------var----------------- var a = []; for(var i= 0; i < 10; i++) ...
- Nginx做缓存
查看服务 netstat -lntp|grep 80 Nginx作为缓存WEB服务 通常情况下缓存是用来减少后端压力, 将压力尽可能的往前推, 减少后端压力,提高网站并发延时 Nginx代理缓存原理 ...
- 通过颜色绘制图片UIImage
+ (UIImage *)clearImageView { UIColor *color=[UIColor clearColor]; CGRect rect =CGRectMake(,,,); UIG ...
- UVa 400 Unix Is命令
简单题 #include <bits/stdc++.h> using namespace std; const int maxn=110; string s[maxn]; int main ...
- 201771010135 杨蓉庆AND张燕 《面对对象程序设计(java)》第十一周学习总结
1.实验目的与要求 (1) 掌握Vetor.Stack.Hashtable三个类的用途及常用API: (2) 了解java集合框架体系组成: (3) 掌握ArrayList.LinkList两个类的用 ...
- [采坑记录] OneDrive同步失败 不能自动上传 不能同步 不能登陆
虽然OneDrive送的空间并不大 但是用来传文档什么的还是够了 但是国内各种不舒服 比如说登陆不上(其他的微软系应用解决方法同理) 原因是因为DNS污染的问题 默认电脑链接上网络之后 DNS是路由器 ...
- js的split() 方法和join()方法
定义和用法 split() 方法用于把一个字符串分割成字符串数组. String.split() 执行的操作与 Array.join 执行的操作是相反的. join() 方法用于把数组中的所有元素放入 ...
- python manage.py shell
启动python有两种方式:python manage.py shell和python. 这两个命令 都会启动交互解释器,但是manage.py shell命令有一个重要的不同: 在启动解释器之前,它 ...
- CSS实现心形、六角星、六边形、平行四边形等几何
本文将利用border属性实现简单几何的绘制: 效果图: 正八角星 说明:采用两个正方形以中心进行旋转叠加: /* 八角星 */ #burst-8 { background: #6376ff1f; w ...
- pacman 包管理器相关设定
pacman 包管理器相关设定 使用国内源 sudo pacman-mirrors -i -c China -m rank 设定 archlinuxcn 源 编辑/etc/pacman.conf,末尾 ...