【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 ...
随机推荐
- Go 开发关键技术指南 | Go 面向失败编程 (内含超全知识大图)
作者 | 杨成立(忘篱) 阿里巴巴高级技术专家 关注"阿里巴巴云原生"公众号,回复 Go 即可查看清晰知识大图! 导读:从问题本身出发,不局限于 Go 语言,探讨服务器中常常遇到的 ...
- 关于jsp的action如何调用servlet的自定义方法
一.起因: 希望将同属于某个模块的简单功能整合到一起,不创建太多的servlet 二.问题描述: action或者method属性是否能直接调用自定义方法 三.补充知识点: 查询得知:servelet ...
- vue卸载与安装+vue创建项目
vue卸载 npm uninstall -g vue-cli npm install -g @vue/cli 和 npm install -g @vue/cli-init 命令安装新版本vue-cli ...
- java篇 之 数组
数组:本身也是对象元素数据类型必须一致,初始值为各种零(跟类型一致),数组中存放 的是对象的引用(地址),对象在其它空间,一旦创建长度不可变,length可以直 接访问 (new的时候才分配空间,创建 ...
- 【MySQL】单表查询
" 目录 where 约束 group by 分组查询 聚合函数 having 过滤 order by 查询排序 limit 限制查询的记录数 # 语法 select 字段1, 字段2 .. ...
- 微信小程序开发豆瓣电影接口失效
豆瓣旧API接口停用,使用以下接口代替 .获取正在热映的电影:https://douban.uieee.com/v2/movie/in_theaters访问参数:start : 数据的开始项 coun ...
- js中的局部函数和全局函数的调用
//局部函数和全局函数的特点 function fc1(){ var name ="chenhao"; function fc2(){ var age = 30; alert(na ...
- SpringCloud或SpringBoot+Mybatis-Plus利用mybatis插件实现数据操作记录及更新对比
引文 本文主要介绍如何使用mybatis插件实现拦截数据库操作并根据不同需求进行数据对比分析,主要适用于系统中需要对数据操作进行记录.在更新数据时准确记录更新字段 核心:mybatis插件(拦截器). ...
- Python - 协议和鸭子类型
参考: Fluent_Python - P430 wiki 这里说的协议是什么?是让Python这种动态类型语言实现多态的方式. 在面向对象编程中,协议是非正式的接口,是一组方法,但只是一种文档,语言 ...
- STM32内部时钟树
1.外部晶振是干什么用的? 2.内部晶振是干什么用的? 3.外部晶振频率的大小能影响什么?