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;
    }
    
  • 相关阅读:
    HDU 1849 Rabbit and Grass
    HDU 1848 Fibonacci again and again
    HDU 1847 Good Luck in CET-4 Everybody!
    HDU 1846 Brave Game
    HDU 1387 Team Queue
    HDU 1870 愚人节的礼物
    HDU 1509 Windows Message Queue
    HDU 4381 Grid
    HDU 5800 To My Girlfriend
    HDU 5806 NanoApe Loves Sequence Ⅱ
  • 原文地址:https://www.cnblogs.com/OFSHK/p/14022884.html
Copyright © 2011-2022 走看看