君北墨吧 关注:16贴子:427
  • 1回复贴,共1
#include <iostream>
#include <string>
using namespace std;
string q(string password){
int n=0,m=0,j=0;
string x="invalid password",y="valid password";
if(password.length()<8){return x;}
if(password.length()>=8){
for(int i=0;i<password.length();i++){
if(password[i]>='a'&&password[i]<='z'){m++;}
if(password[i]>='A'&&password[i]<='Z'){n++;}
if(password[i]>='0'&&password[i]<='9'){j++;}
}
}
if(j<1){return x;}
if(j==0 && n==0){return x;}
if(n<1){return x;}
if(j>=1 && m+n+j>=0){return y;}
}
int main()
{
string a;
cin>>a;
cout<<q(a);
return 0;
}


IP属地:上海来自Android客户端1楼2019-06-21 09:42回复
    #include <iostream>
    using namespace std;
    int isprime(int x ){
    int flag =1;
    if (x==1){
    flag=0;
    }
    for(int i=2;i<x;i++){
    if(x%i==0){
    flag =0;
    break;
    }
    }
    if (flag )return 1;
    return 0;}
    int ishuiwen(int x){
    int c,t=0;
    c=x;
    while (c){
    t*=10;
    t+=c%10;
    c/=10;}
    if (t==x)return 1;
    return 0;
    }
    int main()
    { int i=1;
    int count =0;
    while (count <100){
    if (isprime(i)&&ishuiwen(i)){
    count ++;
    cout <<i<<" ";
    if (count%10 ==0){cout <<endl;}
    }
    i++;
    }
    return 0;
    }


    IP属地:上海来自Android客户端2楼2019-06-21 09:42
    回复