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 ...
随机推荐
- 将ECSHOP会员注册页面的Email修改成非必填项
将ECSHOP会员注册页面的Email修改成非必填项 ECSHOP教程/ ecshop教程网(www.ecshop119.com) 2011-07-29 有人说,在后台的 “会员注册项设置 ”里面 ...
- Logistic Regression and Gradient Descent
Logistic Regression and Gradient Descent Logistic regression is an excellent tool to know for classi ...
- mysql 导入大sql文件时 max_allowed_packet 选项的设置
mysql根据配置文件会限制server接受的数据包大小. 有时候大的插入和更新会受max_allowed_packet 参数限制,导致写入或者更新失败. 查看目前配置 show VARIABLES ...
- Go的50度灰:Golang新开发者要注意的陷阱和常见错误
Go的50度灰:Golang新开发者要注意的陷阱和常见错误 http://colobu.com/2015/09/07/gotchas-and-common-mistakes-in-go-golang/
- powerdesigner设置表主键列为自动增长。
powerdesigner 版本12.5 创建表就不说了.下面开始介绍设置自动增长列. 1 在表视图的列上创建.双击表视图,打开table properties ———>columens ,双击 ...
- 微信也有土豪版 针对iPhone 6/6 Plus进行优化
土豪们最近都上手iPhone 6/6 Plus了,烦恼的是iPhone 6/Plus增大了屏幕和分辨率,由此带来了不少应用的适配问题,排版乱了,app周边多了一片空白,是不是很煞风景?微信团队昨天放出 ...
- Word Amalgamation(枚举 + 排序)
Word Amalgamation Time Limit: 1 Sec Memory Limit: 64 MB Submit: 373 Solved: 247 Description In mil ...
- Hadoop之伪分布环境搭建
搭建伪分布环境 上传hadoop2.7.0编译后的包并解压到/zzy目录下 mkdir /zzy 解压 tar -zxvf hadoop.2.7.0.tar.gz -C /zzy 配置hado ...
- java笔记--用ThreadLocal管理线程,Callable<V>接口实现有返回值的线程
用ThreadLocal管理线程,Callable<V>接口实现有返回值的线程 ThreadLocal在我的笔记"关于线程同步"的第5种方式里面有介绍,这里就不多说了. ...
- cocos2d 如何优化内存使用
如何优化内存使用 内存优化原理 为优化应用内存使用,开发人员首先应该知道什么最耗应用内存,答案就是纹理! 纹理几乎会占据90%应用内存.所以尽量最小化应用的纹理内存使用,否则应用很有可能会因为低内存而 ...