题目链接

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. dedecms 调用父栏目下的所有子栏目

    效果如下: 代码如下: <div class="productxilie"> <ul> {dede:channelartlist row=6 typeid ...

  2. iscroll 子表左右滚动同时保持页面整体上下滚动

    if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultExce ...

  3. 如何在IIS7上配置 FTP7并使用IIS管理凭据方式进行验证

    在 Windows Server 2008 R2 发布后,gOxiA 就开始着手于相关的测试和评估.IIS 是重点测试和评估之一!而今天与大家分享的是如何在  IIS7 上配置 FTP7 使用 IIS ...

  4. tomcat下配置https方式

    [本地HTTPS]①.<Connector SSLEnabled="true" clientAuth="false" keystoreFile=" ...

  5. 计算机网络漫谈:OSI七层模型与TCP/IP四层(参考)模型

    提纲.png 一.七层?四层? OSI模型(Open System Interconnection Reference Model,缩写为OSI),全名“开放式系统互联通信参考模型”,是一个试图使各种 ...

  6. java 环境变量配置 Mac

    大家在windows里面配置JDK环境变量很容易,但是如果要在mac里面配置JDK环境变量和windows里面有所不同,具体如下: 第一: mac OS里面自带jdk,不过是1.6的版本,现在很多人使 ...

  7. zepto jquery和zepto的区别?

    jQuery 由于强大的生命力基本上是一个事实标准,所以大部分工具 lib 在 DOM 操作.动画等功能上或多或少都会是 jQuery-like 的. Zepto 的 API 就是完全兼容 jQuer ...

  8. UNP学习笔记(第三章:套接字编程简介)

    本章开始讲解套接字API. 套接字地址结构 IPv4套接字地址结构 它以sockaddr_in命名,下面给出它的POSIX定义 struct in_addr { in_addr_t s_addr; } ...

  9. SQL系列函数--字符串函数

    1.charindex函数用来寻找一个指定的字符(串)在另一个字符串中的起始位置,返回一个整数,没找到就返回0 select CHARINDEX('SQL','Microsoft SQL SERVER ...

  10. IDEA小技巧-随时更新

    © 版权声明:本文为博主原创文章,转载请注明出处 1.设置删除一行快捷键 File->Settings->keymap->Delete Line 2.设置代码提示快捷键 File-& ...