2011-12-17 06:52:15
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2024
题意:中文。经典c问题。
代码:
# include <stdio.h>
char str[1010] ;
int test (char s[])
{
int i ;
if (s[0] >= '0' && s[0] <= '9') return 0 ;
for (i = 0 ; s[i] ; i++)
{
if (s[i] == '_') continue ;
if (s[i] >= '0' && s[i] <= '9') continue ;
if (s[i] >= 'A' && s[i] <= 'Z') continue ;
if (s[i] >= 'a' && s[i] <= 'z') continue ;
return 0 ;
}
return 1 ;
}
int main ()
{
int T ;
scanf ("%d%*c", &T) ;
while (T--)
{
gets (str) ;
puts (test(str) ? "yes" : "no") ;
}
}