HDU 2024. 一道吐槽题(连getline都不让用)
原题链接
简单
作者:
史一帆
,
2021-05-30 21:52:26
,
所有人可见
,
阅读 262
#include <iostream>
#include <cstring>
#include <stdio.h>
#include <algorithm>
using namespace std;
const int N = 60;
int n, cnt;
char a[N];
int main()
{
cin >> n;
while (n -- )
{
if (cnt == 0) getchar();
cnt ++ ;
int flag = 1;
gets(a);
for (int i = 0; i < strlen(a); i ++ )
{
if (a[0] == '_' || isupper(a[0]) || islower(a[0]));
else
{
flag = 0; break;
}
if (a[i] == '_' || isupper(a[i]) || islower(a[i]) || (a[i] - '0' >= 0 && a[i] - '0' <= 9));
else
{
flag = 0; break;
}
}
if (!flag) printf("no\n");
else printf("yes\n");
}
return 0;
}