2024题杭电acm哪里错了?求高手解答

2024-12-21 03:21:43
推荐回答(1个)
回答1:

加上一个getchar();

#include
#include
int main()
{
int n,i,t,a;
char s[52];
while(scanf("%d",n)!=EOF)
{ getchar();
for(i=0;i {
gets(s);
if((s[0]>='a'&&s[0]<='z')||(s[0]>='A'&&s[0]<='Z')||(s[0]=='_'))
a=1;
else
a=0;
if(a==1)
{
t=strlen(s);
for(i=0;i {
if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z')||(s[i]=='_')||(s[i]<'9'&&s[i]>'0'))
continue;
else
{ a=0;break;}
}
}
if(a==1)
printf("yes\n");
else
printf("no\n");
}