WA求调

B3843 [GESP202306 三级] 密码合规

穼柗° @ 2024-06-24 16:26:51

报错信息:Wrong Answer.wrong answer On line 2 column 1, read a, expected y.

代码↓

#include <iostream>
#include <cstring>
using namespace std;
signed main(void) {
    string s,t="";
    cin>>s;
    register int i,big,small,number,tschar;
    for(big=small=number=tschar=i=0;i<s.size();i++)
        if(s[i]!=',') {
            t+=s[i];
            if(s[i]>='0'&&s[i]<='9') number=1;
            else if(s[i]>='A'&&s[i]<='Z') big=1;
            else if(s[i]>='a'&&s[i]<='z') small=1;
            else if(s[i]=='!'||s[i]=='@'||s[i]=='#'||s[i]=='$') tschar=1;
            else for(i++;i<s.size();i++)
                if(s[i]==',') {t="I love YWQ, WRX, and DYX!!!\n",i--;break;}
        }
        else {
            if(t.size()<6||t.size()>12||big+small+number<2||!tschar) big=small=number=tschar=0;
            else cout<<t<<'\n';
            t="";
        }
    if(!(t.size()<6||t.size()>12||big+small+number<2||!tschar)) cout<<t<<'\n';
    return 0;
}

by sbh2012 @ 2024-06-24 16:36:31

错误答案。错误在第2行第1列,读入a,应为y。


by Betrayer_of_love @ 2024-06-24 16:41:11

#include <bits/stdc++.h>
using namespace std;
int n;
string a1;
char a2;
int i;
bool as(string s){
    for(int i=0; i<s.size(); i++){
        if(!((s[i]>='0'&&s[i]<='9')||(s[i]>='A'&&s[i]<='Z')||(s[i]>='a'&&s[i]<='z')||s[i]=='!'||s[i]=='@'||s[i]=='#'||s[i]=='$')){
            return false;
        }
    }
    return true;
}
bool bs(string x){
    int zhong1=0;
    int zhong2=0;
    int zhong3=0;
    int zi=0;
    for(int i=0; i<x.size(); i++){
        if(x[i]>='0'&&x[i]<='9'){
            zhong1=1;
        }
        else if(x[i]>='A'&&x[i]<='Z'){
            zhong2=1;
        }
        else if(x[i]>='a'&&x[i]<='z'){
            zhong3=1;
        }
        else if(x[i]=='!'||x[i]=='@'||x[i]=='#'||x[i]=='$'){
            zi=1;
        }
    }
    if((zhong1+zhong2+zhong3)>=2&&zi){
        return true;
    }
    return false;
}
int main(){
    while(cin>>a2){
        if(a2!=',') {
            a1=a1+a2;
        }
        else{
            if(a1.size()>=6&&a1.size()<=12){
                if(as(a1)){
                    if(bs(a1)){
                        cout<<a1<<endl;
                    }
                }
            }
            a1.erase(0);
        }
    }
    return 0;
}

@穼柗


by imJTya @ 2024-06-24 17:44:23

我等了2个小时而你...


by Boing777_300er @ 2024-06-27 18:33:35

这都是什么?看不懂.


|