zoukankan      html  css  js  c++  java
  • 3149 爱改名的小融 2

    3149 爱改名的小融 2

     

    时间限制: 2 s
    空间限制: 128000 KB
    题目等级 : 黄金 Gold
     
     
     
    题目描述 Description

    Wikioi上有个人叫小融,他喜欢改名。
    现在他的要求变了,只要是英文字母就是他的名字。
    先给你N个名字,请你一一判断是不是小融。
    本题还加强了测试数据

    输入描述 Input Description

    N
    N行名字(全部为字符)

    输出描述 Output Description

     N行,YES或NO(大写)

    样例输入 Sample Input

    3
    &6*14315
    Rinkement
    micsloox

    样例输出 Sample Output

    NO

    YES

    YES

    数据范围及提示 Data Size & Hint

    对于40%的数据 N≤10 名字长度≤100
    对于100%的数据 N≤50 名字长度≤100000

     1 #include<iostream>
     2 using namespace std;
     3 string s;
     4 bool flag=0;
     5 int main() 
     6 {
     7     int n;
     8     cin>>n;
     9     for(int i=1;i<=n;i++) 
    10     {
    11         cin>>s;
    12         flag=0;
    13         int l=s.length();
    14         for(int j=0;j<l;j++) 
    15         {
    16             if(s[i]>='A'&&s[i]<='Z'||s[i]>='a'&&s[i]<='z');
    17             else 
    18             {
    19                 cout<<"NO"<<endl;
    20                 flag=1;
    21                 break;
    22             }
    23         }
    24         if(!flag)
    25             cout<<"YES"<<endl;
    26     }
    27     return 0;
    28 }
  • 相关阅读:
    左偏树
    论在Windows下远程连接Ubuntu
    ZOJ 3711 Give Me Your Hand
    SGU 495. Kids and Prizes
    POJ 2151 Check the difficulty of problems
    CodeForces 148D. Bag of mice
    HDU 3631 Shortest Path
    HDU 1869 六度分离
    HDU 2544 最短路
    HDU 3584 Cube
  • 原文地址:https://www.cnblogs.com/sssy/p/6736034.html
Copyright © 2011-2022 走看看