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特别不喜欢那些随便转载别人的原创文章又不给 ...
随机推荐
- yum安装某个包出现冲突的情况
yum安装是非常方便的,可以自动解决依赖问题,但是有时候我们安装包会出现冲突,这个时候我们就要查找是哪些包与哪些包出现冲突,然后再针对性的解决问题. 一般来说起冲突的包会报出来,主要为两点 1.包与包 ...
- MySQL SELECT语句中只能输出1000行数据的原因
同事反映,客户的一套MySQL生产库,执行SELECT.. INTO OUTFILE语句只能导出1000行 最初以为是系统参数被重新设置了,建议他更改系统参数 mysql> set global ...
- 张高兴的 .NET Core IoT 入门指南:(一)环境配置、Blink、部署
如何在 Raspberry Pi 的 Raspbian 上构建使用 GPIO 引脚的 IoT 程序?你可能会回答使用 C++ 或 Python 去访问 Raspberry Pi 的引脚.现在,C# 程 ...
- PyQt5--ShowWindowCenter
# -*- coding:utf-8 -*- ''' Created on Sep 13, 2018 @author: SaShuangYiBing ''' import sys from PyQt5 ...
- MySQL多实例.md
MySQL5.7多实例配置 数据库实例1配置文件 # cat /etc/my.cnf [mysqld] datadir=/data/mysql port=3306 socket=/tmp/mysql. ...
- ELK日志收集分析平台 (Elasticsearch+Logstash+Kibana)使用说明
使用ELK对返回502的报警进行日志的收集汇总 eg:Server用户访问网站返回502 首先在zabbix上找到Server的IP 然后登录到elk上使用如下搜索条件: pool_select:X. ...
- MetaMask/eth-block-tracker
https://github.com/MetaMask/eth-block-tracker A JS module for keeping track of the latest Ethereum b ...
- VMware虚拟机下Linux系统的全屏显示
在VMware虚拟机下的Linux无法全屏的问题的解决方案如下: 1. 启动虚拟机,并启动Redhat6.4. 2. 点击“view”——然后将Autofit window这个选项勾选.(一般 ...
- 织梦提交表单(提交留言)前的js校验
第一种情况:页面有引入jq的 在form标签上加上id <form action="/plus/diy.php" enctype="multipart/form-d ...
- 将公钥部署到远程Git仓库(coding.net)
步骤: 1.下载git通用客户端并且安装. 2.右键,在弹出的对话框中选择Git Bash 3.创建本地ssha)在弹出的终端输入ssh-keygen -t rsa -C "username ...