[恢]hdu 2043

2011-12-20 02:48:53

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2043

题意:中文。

代码:

# include <stdio.h>


char str[60] ;


int test (char str[])
{
int i, flag[4] = {0,0,0,0} ;
for (i = 0 ; str[i] ; i++)
{
if (str[i] >= 'A' && str[i] <= 'Z') flag[0] = 1 ;
else if (str[i] >= 'a' && str[i] <= 'z') flag[1] = 1 ;
else if (str[i] >= '0' && str[i] <= '9') flag[2] = 1 ;
else flag[3] = 1 ;
}
return ((i >= 8 && i <= 16) &&
(flag[0]+flag[1]+flag[2]+flag[3] >=3)) ;
}


int main ()
{
int T ;
scanf ("%d%*c", &T) ;
while (T--)
{
gets (str) ;
puts (test(str) ? "YES" : "NO") ;
}
return 0 ;
}



原文地址:https://www.cnblogs.com/lzsz1212/p/2315240.html