题目链接

https://www.patest.cn/contests/pat-b-practise/1081

思路

有一个坑点 可能会输入空格 也就是说 要用 geline 或者 gets()

然后 对于

“………………….” 这种 一串小数点的数据 应该输出什么 我也不知道。。

应该是没有这种数据吧

AC代码

#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits> #define CLR(a) memset(a, 0, sizeof(a))
#define pb push_back using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll; const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-6; const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7; int legal(string s)
{
int len = s.size();
int a = 0, b = 0, c = 0;
for (int i = 0; i < len; i++)
{
if (s[i] >= '0' && s[i] <= '9' )
{
a = 2;
continue;
}
else if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))
{
b = 3;
continue;
}
else if (s[i] == '.')
continue;
else
return 0;
}
return a + b;
} int main()
{
int t;
cin >> t;
getchar();
while (t--)
{
string s;
getline(cin, s);
int len = s.size();
if (len < 6)
printf("Your password is tai duan le.\n");
else
{
int ans = legal(s);
if (ans == 0)
printf("Your password is tai luan le.\n");
else if (ans == 2)
printf("Your password needs zi mu.\n");
else if (ans == 3)
printf("Your password needs shu zi.\n");
else
printf("Your password is wan mei.\n");
}
}
}

PAT 乙级 1081. 检查密码 (15) 【字符串】的更多相关文章

  1. PAT Basic 1081 检查密码 (15 分)

    本题要求你帮助某网站的用户注册模块写一个密码合法性检查的小功能.该网站要求用户设置的密码必须由不少于6个字符组成,并且只能有英文字母.数字和小数点 .,还必须既有字母也有数字. 输入格式: 输入第一行 ...

  2. PAT(B) 1081 检查密码(Java)

    题目链接:1081 检查密码 (15 point(s)) 题目描述 本题要求你帮助某网站的用户注册模块写一个密码合法性检查的小功能.该网站要求用户设置的密码必须由不少于6个字符组成,并且只能有英文字母 ...

  3. 1081 检查密码 (15分)C语言

    本题要求你帮助某网站的用户注册模块写一个密码合法性检查的小功能.该网站要求用户设置的密码必须由不少于6个字符组成,并且只能有英文字母.数字和小数点 .,还必须既有字母也有数字. 输入格式: 输入第一行 ...

  4. PAT 乙级 1076 Wifi密码 (15)

    下面是微博上流传的一张照片:“各位亲爱的同学们,鉴于大家有时需要使用wifi,又怕耽误亲们的学习,现将wifi密码设置为下列数学题答案:A-1:B-2:C-3:D-4:请同学们自己作答,每两日一换.谢 ...

  5. PAT 1081 检查密码(15) (代码+思路)

    1081 检查密码(15 分) 本题要求你帮助某网站的用户注册模块写一个密码合法性检查的小功能.该网站要求用户设置的密码必须由不少于6个字符组成,并且只能有英文字母.数字和小数点 .,还必须既有字母也 ...

  6. PAT 1081 检查密码

    https://pintia.cn/problem-sets/994805260223102976/problems/994805261217153024 本题要求你帮助某网站的用户注册模块写一个密码 ...

  7. 【PAT】B1081 检查密码(15 分)

    水题 #include<cstdio> #include<string.h> #include<ctype.h> #include<algorithm> ...

  8. PAT乙级 1031. 查验身份证(15) 标志要清零!!!!!!!!!

    1031. 查验身份证(15) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 一个合法的身份证号码由17位地区. ...

  9. PAT 乙级 1067 试密码(20 分)

    1067 试密码(20 分) 当你试图登录某个系统却忘了密码时,系统一般只会允许你尝试有限多次,当超出允许次数时,账号就会被锁死.本题就请你实现这个小功能. 输入格式: 输入在第一行给出一个密码(长度 ...

随机推荐

  1. 安装XAMPP时出现 unable to realloc 83886080 bytes

    参考:https://www.apachefriends.org/faq_linux.html 转载:http://blog.xinspace.space/2015/08/06/xampp-unabl ...

  2. 2017.2.28 activiti实战--第五章--用户与组及部署管理(二)部署流程资源

    学习资料:<Activiti实战> 第五章 用户与组及部署管理(二)部署流程资源 内容概览:讲解流程资源的读取与部署. 5.2 部署流程资源 5.2.1 流程资源 流程资源常用的有以下几种 ...

  3. log4j.properties(信息打印)

    ### set log levels ###log4j.rootLogger = INFO , console , debug , error ### console ###log4j.appende ...

  4. AutoCAD参照编辑期间不允许使用 SAVE 命令怎么办

    如下所示,点击保存按钮的时候下方出现如下提示:参照编辑期间不允许使用 SAVE 命令,同时图变成灰褐色,也无法改变颜色   点击修改-外部参照和块编辑-保存参照编辑即可.可以发现图的颜色也变正常了. ...

  5. Java Transaction Management

    Just a few weeks ago, I had a discussion with one of my colleagues about how to manage the transacti ...

  6. LeetCode Search in Rotated Sorted Array II -- 有重复的旋转序列搜索

    Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this ...

  7. csdn开源夏令营-ospaf中期报告

    1.背景         随着将中期的代码托管到CSDN的平台上,ospaf(开源项目成熟度分析工具)已经有了小小的雏形.当然还远远不够.       首先还是要感谢这次活动组织方CSDN,感觉挺有G ...

  8. 【Python】存储数据

    很多程序都要求用户输入某种信息,如让用户存储游戏首选项或者提供可视化数据,不管专注什么,程序都要将数据进行存储,那么如何存储呢? JSON(JavaScript Object Notation)格式最 ...

  9. 使用chrome调试前端线上代码

    家都知道在前端开发过程中,为加快网站静态资源加载速度都会对js/css等静态资源进行压缩合并再部署到生产环境,而在实际开发过程中开发人员一般都是在开发环境进行源码文件开发调试的,当部署平台或部署人员将 ...

  10. WPF的ListView控件自定义布局用法实例

    正文: 如何布局是在App.xaml中定义源码如下 <Application x:Class="CWebsSynAssistant.App"   xmlns="ht ...