zoukankan      html  css  js  c++  java
  • 第五届天梯赛模拟题

    PS

    前天周六12-5点的比赛拿了河南省CCPC金牌,第二十名尾金,感觉人生都得到了升华!!!哈哈哈太开心了实在是!!!

    现在好好准备一下这周六的天梯赛,拿一个好成绩出来。

    思路

    这题之前模拟赛的时候写完错了一组数据。。。

    今天还是。。。。

    没考虑把到输入空格的情况,cin不能读入空格

    在T组数据的T输入完后,需要getchar吸收回车,而且getchar放在while(T--)里面的话题目样例是正确的但是提交有一组数据错误,因为,getchar一直以来都是放在while外面的!!!!我傻了。。。

    题目链接

    https://pintia.cn/problem-sets/1328516275013013504/problems/1328517730289700869

    AC代码

    #include<bits/stdc++.h>
    using namespace std;
    #define inf 0x3f3f3f3f
    typedef long long ll;
    #define f(i,x,y) for(int i=x;i<y;i++)
    int main()
    {
        int T;
        cin>>T;
        getchar();
        while(T--)
        {
            //getchar();
            string s;;
            //cin>>s;
            getline(cin,s);
            // cout<<s<<"****"<<endl;
            if(s.size()<6)
            {
                // cout<<s.size();
                cout<<"Your password is tai duan le."<<endl;
                continue;
            }
            int zimu=0,shuzi=0,dian=0,fei=0;
            f(i,0,s.size())
            {
                if(s[i]>='A'&&s[i]<='Z')
                    zimu++;
                else if(s[i]>='a'&&s[i]<='z')
                    zimu++;
                else if(s[i]>='0'&&s[i]<='9')
                    shuzi++;
                else if(s[i]=='.')
                    dian++;
                else fei++;
            }
            if(fei)
                cout<<"Your password is tai luan le."<<endl;
            else if(!zimu)
                cout<<"Your password needs zi mu."<<endl;
            else if(!shuzi)
                cout<<"Your password needs shu zi."<<endl;
            else
                cout<<"Your password is wan mei."<<endl;
        }
        return 0;
    }
    
  • 相关阅读:
    利用Redis和Flask维护一个通用爬虫代理池
    在scrapy_splash中加载本地Cookies
    Splash对接Scrapy
    Selenium和pymongo的简单复习
    Scrapy框架
    web.xml is missing and <failOnMissingWebXml> is set to true
    深入Mybatis配置文件
    SSH和SSM的比较
    classpath路径指什么
    数据库范式
  • 原文地址:https://www.cnblogs.com/OFSHK/p/14022884.html
Copyright © 2011-2022 走看看