请高手看下,杭电ACM2043,我的代码为啥WA?测试时数据过的啊!

2024-11-21 15:47:19
推荐回答(2个)
回答1:

#include
#include
void main()
{
char s[51];
int m,i,j,n,t;
while(scanf("%d%*c",&m)==1)
{
for(i=0;i {
gets(s);
n=strlen(s);
if(n<8 || n>16)
{
printf("NO\n");
continue; // 粗心大意啊,应该是continue的说
}
else
{
t=0;
for(j=0;j {
if((s[j]>='a') && (s[j]<='z'))
{
t++;
break;
}
}
for(j=0;j {
if((s[j]>='A') && (s[j]<='Z'))
{
t++;
break;
}
}
for(j=0;j {
if((s[j]>='0') && (s[j]<='9'))
{
t++;
break;
}
}
for(j=0;j {
if((s[j]=='~') || (s[j]=='!') || (s[j]=='@') || (s[j]=='#') || (s[j]=='$') || (s[j]=='%') || (s[j]=='^'))
{
t++;
break;
}
}
if(t<3)
printf("NO\n");
else
printf("YES\n");
}

}
}
}

回答2:

for ( i = 0; i < N - 1; i ++ )
{
for ( j = 0; j < N - i - 1; j ++ )
{

if( c[j] < c[j+1] )
{
t = a[j];
a[j] = a[j + 1];
a[j + 1] = t;
t = b[j];
b[j] = b[j + 1];
b[j + 1] = t;
t = c[j];
c[j] = c[j + 1];
c[j + 1] = t;
}

t是int
其它的是double