标签:
Wikioi上有个人叫小融,他喜欢改名。
现在他的要求变了,只要是英文字母就是他的名字。
先给你N个名字,请你一一判断是不是小融。
本题还加强了测试数据
N
N行名字(全部为字符)
N行,YES或NO(大写)
3
&6*14315
Rinkement
micsloox
NO
YES
YES
对于40%的数据 N≤10 名字长度≤100
对于100%的数据 N≤50 名字长度≤100000
#include<cstdio> #include<cstring> #include<algorithm> #include<iostream> using namespace std; #define N 100010 char str[N];int n; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%s",str); int flag=0,len=strlen(str); for(int j=0;j<len;j++){ if((str[j]>=‘a‘&&str[j]<=‘z‘)||(str[j]>=‘A‘&&str[j]<=‘Z‘)); else {flag=1;break;} } printf("%s\n",flag?"NO":"YES"); } return 0; }
CODEVS 必做题:3149、2821、1531、3369、1230
标签:
原文地址:http://www.cnblogs.com/shenben/p/5619089.html