hdu2024

为什么80%的码农都做不了架构师?>>>   hot3.png

15103702_FjSP.gif 15103702_nj4i.gif View Code

    
#include " iostream "
using namespace std;
int main()
{
int n;
char ch[ 1000 ];
int i;
scanf(
" %d\n " , & n); // cin>>n;cout<
while (n -- )
{
gets(ch);
int count = 0 ;
if ( ! (ch[ 0 ] >= ' a ' && ch[ 0 ] <= ' z ' ) && ch[ 0 ] != ' _ ' &&! (ch[ 0 ] >= ' A ' && ch[ 0 ] <= ' Z ' )) count = 1 ;
else
{
for (i = 0 ;i < strlen(ch);i ++ )
{
if ( ! (ch[i] >= ' a ' && ch[i] <= ' z ' ) &&! (ch[i] >= ' 0 ' && ch[i] <= ' 9 ' ) && ch[i] != ' _ ' &&! (ch[i] >= ' A ' && ch[i] <= ' Z ' ))
{
count
= 1 ; break ;
}
}
}

if (count == 0 ) cout << " yes " << endl;
else cout << " no " << endl;
}
return 0 ;
}

http://acm.hdu.edu.cn/showproblem.php?pid=2024 (基础知识)

标识符:字母,数字和下划线组成,以字母或下划线开头

转载于:https://my.oschina.net/garyun/blog/602825

你可能感兴趣的:(hdu2024)