clairxxx 2020-01-07 21:25
浏览 119

小白一枚,回文串和安全密码问题在codeblock运行没啥问题,但是oj上显示答案错误,大佬们能帮忙看看吗

#include ///安全密码
using namespace std;

int main()
{
char s[55];
while(scanf("%s",&s)!=EOF){
int len =strlen(s);
if(len printf("NO\n");
continue;
}
bool low= false,up=false,sng=false,num=false;
for(int i=0;i if(isdigit(s[i]))num=true;
else if(islower(s[i]))low=true;
else if(isupper(s[i]))up=true;
else sng=true;
}
int cnt=0;
if(low)cnt++;
if(up)cnt++;
if(num)cnt++;
if(sng)cnt++;
if(cnt>=3)printf("YES\n");
else printf("NO\n");
}
return 0;
}

#include ///回文串
using namespace std;
char s[103];

bool judge(){
int len=strlen(s);
for(int i=0;i<len/2;i++){
if(s[i]!=s[len-i-1])return false;
}
return true;
}

int main()
{
int T=1;
while(scanf("%s",&s)!=EOF){
if(judge())printf("case%d:yes\n",T++);
else printf("case%d:no\n",T++);
}

}

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog