PAT甲题题解-1035. Password (20)-水
题意:
给n个用户名和密码,把密码中的1改为@,0改为%,l改为L,O改为o。
让你输出需要修改密码的用户名个数,以及对应的用户名和密码,按输入的顺序。
如果没有用户需要修改,则输出对应的语句,注意单复数。。。
没啥好说的,就for一遍密码,把需要改的改下,存入到ans中去。
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
#include <cmath>
using namespace std;
const int maxn=+;
struct Node{
char team[];
char pass[];
}ans[maxn];
int main()
{
int n;
int cnt=;
char team[],pass[];
scanf("%d",&n);
bool flag;
for(int i=;i<n;i++){
scanf("%s %s",team,pass);
flag=true;
int len=strlen(pass);
for(int j=;j<len;j++){
//printf("%c\n",pass[j]);
if(pass[j]==''){
//printf("1->@\n");
flag=false;
pass[j]='@';
}
else if(pass[j]==''){
//printf("0->\%\n");
flag=false;
pass[j]='%';
}
else if(pass[j]=='l'){
//printf("l->L\n");
flag=false;
pass[j]='L';
}
else if(pass[j]=='O'){
//printf("O->o\n");
flag=false;
pass[j]='o';
}
}
if(!flag){
strcpy(ans[cnt].team,team);
strcpy(ans[cnt].pass,pass);
cnt++;
}
}
if(cnt==){
if(n==)
printf("There is %d account and no account is modified\n",n);
else
printf("There are %d accounts and no account is modified\n",n);
}
else{
printf("%d\n",cnt);
for(int i=;i<cnt;i++){
printf("%s %s\n",ans[i].team,ans[i].pass);
}
}
return ;
}
PAT甲题题解-1035. Password (20)-水的更多相关文章
- PAT甲题题解-1008. Elevator (20)-大么个大水题,这也太小瞧我们做题者的智商了
如题... #include <iostream> #include <cstdio> #include <algorithm> #include <cstr ...
- PAT甲题题解-1061. Dating (20)-字符串处理,水水
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...
- PAT甲题题解-1077. Kuchiguse (20)-找相同后缀
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...
- PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...
- PAT甲题题解-1011. World Cup Betting (20)-误导人的水题。。。
题目不严谨啊啊啊啊式子算出来结果是37.975样例输出的是37.98我以为是四舍五入的啊啊啊,所以最后输出的是sum+0.005结果告诉我全部错误啊结果直接保留两位小数就可以了啊啊啊啊 水题也不要这么 ...
- PAT甲题题解-1019. General Palindromic Number (20)-又是水题一枚
n转化为b进制的格式,问你该格式是否为回文数字(即正着写和倒着写一样)输出Yes或者No并且输出该格式又是水题... #include <iostream> #include <cs ...
- PAT甲题题解-1041. Be Unique (20)-水题
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789189.html特别不喜欢那些随便转载别人的原创文章又不给 ...
- PAT甲题题解-1050. String Subtraction (20)-水题
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...
- PAT甲题题解-1120. Friend Numbers (20)-水题
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789775.html特别不喜欢那些随便转载别人的原创文章又不给 ...
随机推荐
- 【Alpha go】Day 3!
[Alpha go]Day 3! Part 0 · 简要目录 Part 1 · 项目燃尽图 Part 2 · 项目进展 Part 3 · 站立式会议照片 Part 4 · Scrum 摘要 Part ...
- vue2.0路由切换后页面滚动位置不变BUG
最近项目中遇到这样一个问题,vue切换路由,页面到顶端的滚动距离仍会保持不变. 方法一: 监听路由 // app.vue export default { watch:{ '$route':func ...
- jfreechart createBarChart 去掉立体感
就是图中每个柱上的白条 提问者采纳 加上这句:barRenderer.setBarPainter(new StandardBarPainter())
- 基于汇编的 C/C++ 协程 - 切换上下文
在前一篇文章<基于汇编的 C/C++ 协程 - 背景知识>中提到一个用于 C/C++ 的协程所需要实现的两大功能: 协程调度 上下文切换 其中调度,其实在技术实现上与其他的线程.进程调度没 ...
- Promise 模式解析:Promise模式与异步及声明式编程
一.构建流程 1.(异步)数据源(请求)的构建:Promise的构建并执行请求: 2.处理流程的构建:then将处理函数保存: 二.处理: 1.请求的响应返回: 2.调用后继处理流程. 三. 1.构建 ...
- redis命令手册
Redis 键(key) 命令 命令 描述 Redis DEL 命令 该命令用于在 key 存在是删除 key. Redis Dump 命令 序列化给定 key ,并返回被序列化的值. Redis E ...
- divide_3
xiao方法 #include<stdio.h> #include<vector> #include<iostream> using namespace std; ...
- Docker学习5-Services – 服务(未完待续)
扩展应用程序并启用负载平衡, 为此,必须在分布式应用程序的层次结构中提升一级:服务.在分布式应用程序中,应用程序的不同部分称为“服务”.例如,一个视频共享站点,它可能包含用于将应用程序数据存储在数据库 ...
- oracle版本兼容问题
问题一描述:本机环境升级为vs2012升级TLS程序为framework4.0,本机ODAC为ODTwithODAC112030.本机为oracle10g本机程序生成成功,运行成功. 发布到服务器后, ...
- memcpy、memmove、memset、memchr、memcmp、strstr详解
第一部分 综述 memcpy.memmove.memset.memchr.memcmp都是C语言中的库函数,在头文件string.h中.memcpy和memmove的作用是拷贝一定长度的内存的内容,m ...