sdut 2163:Identifiers(第二届山东省省赛原题,水题)
Identifiers
Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
An identifier is a sequence of characters. A valid identifier can contain only upper and lower case alphabetic characters, underscore and digits, and must begin with an alphabetic character or an underscore. Given a list of chararcter sequences, write a program to check if they are valid identifiers.
输入
输出
For each of the N lines, output "Yes" (without quote marks) if the character sequence contained in that line make a valid identifier; output "No" (without quote marks) otherwise.
示例输入
7
ValidIdentifier
valid_identifier
valid_identifier
0_invalid_identifier
1234567
invalid identifier
adefhklmruvwxyz12356790_-.,:;!?'"()[]ABCDGIJLMQRSTVWXYZ
示例输出
Yes
Yes
Yes
No
No
No
No
提示
来源
#include <iostream>
#include <stdio.h>
using namespace std; int main()
{
int i,j,n;
cin>>n;
getchar();
for(i=;i<=n;i++){
char a[];
cin.getline(a,,'\n');
if(('a'<=a[] && a[]<='z') || ('A'<=a[] && a[]<='Z') || a[]=='_'){
for(j=;a[j];j++)
if(!(('a'<=a[j] && a[j]<='z') ||
('A'<=a[j] && a[j]<='Z') ||
(''<=a[j] && a[j]<='') ||
a[j]=='_') )
break;
if(a[j])
cout<<"No"<<endl;
else
cout<<"Yes"<<endl;
}
else
cout<<"No"<<endl;
}
return ;
} /**************************************
Problem id : SDUT OJ 2163
User name : Miracle
Result : Accepted
Take Memory : 452K
Take Time : 0MS
Submit Time : 2014-04-20 09:18:49
**************************************/
Freecode : www.cnblogs.com/yym2013
sdut 2163:Identifiers(第二届山东省省赛原题,水题)的更多相关文章
- sdut 2162:The Android University ACM Team Selection Contest(第二届山东省省赛原题,模拟题)
The Android University ACM Team Selection Contest Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里 ...
- sdut 2165:Crack Mathmen(第二届山东省省赛原题,数论)
Crack Mathmen Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Since mathmen take securit ...
- sdut 2154:Shopping(第一届山东省省赛原题,水题)
Shopping Time Limit: 1000MS Memory limit: 65536K 题目描述 Saya and Kudo go shopping together.You can ass ...
- sdut 2152:Balloons(第一届山东省省赛原题,DFS搜索)
Balloons Time Limit: 1000MS Memory limit: 65536K 题目描述 Both Saya and Kudo like balloons. One day, the ...
- sdut 2159:Ivan comes again!(第一届山东省省赛原题,STL之set使用)
Ivan comes again! Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 The Fairy Ivan gave Say ...
- sdut 2153:Clockwise(第一届山东省省赛原题,计算几何+DP)
Clockwise Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Saya have a long necklace with ...
- sdut 2158:Hello World!(第一届山东省省赛原题,水题,穷举)
Hello World! Time Limit: 1000MS Memory limit: 65536K 题目描述 We know that Ivan gives Saya three problem ...
- i春秋第二届春秋欢乐赛RSA256writeup
i春秋第二届春秋欢乐赛writeup 下载之后进行解压 发现四个文件 0x01看到题目是RSA的 又看到public.key 所以直接用kali linux的openssl 0x02可以看到e就是E ...
- sdut 2603:Rescue The Princess(第四届山东省省赛原题,计算几何,向量旋转 + 向量交点)
Rescue The Princess Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Several days ago, a b ...
随机推荐
- OOA/OOD/OOP(了解)
Object-Oriented Analysis:面向对象分析方法 是在一个系统的开发过程中进行了系统业务调查以后,按照面向对象的思想来分析问题.OOA与结构化分析有较大的区别.OOA所强调的是在系统 ...
- 利用dedecms autoindex让文章列表加上序列号
有些时候我们在制作模板的需要在文章标题前面加上序列号,可以通过织梦自带的autoindex属性来实现,实现方法很简单,只需要在序号递增的地方加上 这段代码就行,[field:global runphp ...
- Java操作xml文件
Bbsxml.java public class Bbsxml { private String imgsrc; private String title; private String url; p ...
- 开源项目剖析之apache-common-pool
前沿 该工程提供了对象池解决方案,该方案主要用于提高像文件句柄,数据库连接,socket通信这类大对象的调用效率.简单的说就是一种对象一次创建多次使用的技术. 整体结构 整个项目有三个包分别是org. ...
- git windows中文目录乱码问题解决
转自:http://blog.chinaunix.net/uid-9789774-id-3080448.html Git的Windows版本Msysgit对中文的支持不够好 当使用时,会出现以下三种情 ...
- hoj3152-Dice 等比数列求和取模
http://acm.hit.edu.cn/hoj/problem/view?id=3152 Dice My Tags (Edit) Source : Time limit : sec Memory ...
- ExtJS学习之路第七步:contentEl与renderTo的区别
上回在Panel的应用中我们应该能大致区分开conteEl和renderTo,这回我们从定义中区分. 在Panel的API中, contentEl:String指定一个现有的HTML元素或者id作为此 ...
- xcode Git
http://blog.csdn.net/w13770269691/article/details/38704941 在已有的git库中搭建新库,并且将本地的git仓库,上传到远程服务器的git库中, ...
- each-Select
While Ruby’s each method is useful, it also comes with an awesome extended family of methods that ar ...
- C++简单使用Jsoncpp来读取写入json文件
一.源码编译 C++操作json字符串最好的库应该就是jsoncpp了,开源并且跨平台.它可以从这里下载. 下载后将其解压到任意目录,它默认提供VS2003和VS2010的工程文件,使用VS2010可 ...