PTA乙级题 1081. 检查密码 (15)

【题目链接】


直接暴力吧

#include<iostream>
#include<cstring>
#include<cctype>
using namespace std;
int main()
{
    int i,j,n,f1,f2;
    cin>>n;
    string a;
    getchar();
    for (i=0;i<n;i++)
    {
        f1=0;f2=0;
        getline(cin,a);
        if (a.size()<6)
        {
            cout<<"Your password is ***an le."<<endl;
            goto a;
        }
        for (j=0;j<a.size();j++)
        {
            if (isdigit(a[j]))
            f1=1;
            else if (isalpha(a[j]))
            f2=1;
            else if (a[j]=='.')
            ;
            else
            {
                cout<<"Your password is tai luan le."<<endl;
                goto a;
            }
        }
        if (f1==0&&f2==1)
        {
            cout<<"Your password needs shu zi."<<endl;
            goto a;
        }
        else if (f2==0&&f1==1)
        {
            cout<<"Your password needs zi mu."<<endl;
            goto a;
        }
        cout<<"Your password is wan mei."<<endl;
        a:;
    }
}