Problem J: 零起点学算法105——C语言合法标识符
#include<stdio.h>
#include<ctype.h>//调用isalpha函数
int main()
{
int n;
char a[];
while(scanf("%d%*c",&n)!=EOF)
{
while(n--)
{
int d=;
gets(a);
if(a[]!='_'&& !isalpha(a[])) //isalpha函数用来判断字符是否为英文字母
{
printf("no\n");
}
else
{
for(int j=;a[j]!='\0';j++)
{
if(a[j]!='_'&&!isalnum(a[j]))
{ d=;
break;
}
}
puts(d ? "yes" : "no");
}
}
}
return ;
}
HINT
C语言的标识符指保留字(for,int,if等)和用户定义的变量名。 C语言的标识符由字母、数字和下划线组成,其中第一个字符必须是字母或者下划线
Problem J: 零起点学算法105——C语言合法标识符的更多相关文章
- 1164: 零起点学算法71——C语言合法标识符(存在问题)
1164: 零起点学算法71——C语言合法标识符 Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 10 ...
- Problem J: 零起点学算法89——程序设计竞赛
#include<stdio.h> //选择排序法 int main(){ ]; while(scanf("%d",&n)!=EOF){ ;i<n;i++ ...
- Problem J: 零起点学算法34——3n+1问题
#include<stdio.h> int main() { ; int n; scanf("%d",&n); ) { ==) n=n*+; else n/=; ...
- Problem D: 零起点学算法95——弓型矩阵
#include<stdio.h> #include<string.h> int main() { ][]; while(scanf("%d%d",& ...
- Problem D: 零起点学算法94——输出矩阵
#include<stdio.h> int main() { ][]; while(scanf("%d %d",&n,&m)!=EOF) { ; ;i& ...
- Problem C: 零起点学算法93——矩阵转置
#include<stdio.h> int main() { ][],b[][]; while(scanf("%d%d",&n,&m)!=EOF) { ...
- Problem A: 零起点学算法91——找出一个数组中出现次数最多的那个元素
#include<stdio.h> int main() { ],b[]={}; while(scanf("%d",&n)!=EOF) { ;i<n;i+ ...
- Problem H: 零起点学算法87——打印所有低于平均分的分数
#include<stdio.h> int main(){ ],b[]; while(scanf("%d",&n)!=EOF){ ; ;i<n;i++){ ...
- Problem F: 零起点学算法85——数组中插入一个数
#include<stdio.h> int main() { ],b[]; while(scanf("%d",&n)!=EOF) { ;i<n;i++) ...
随机推荐
- static class 和 non static class 的区别
static class non static class 1.用static修饰的是内部类,此时这个 内部类变为静态内部类:对测试有用: 2.内部静态类不需要有指向外部类的引用: 3.静态类只能访问 ...
- monkey测试===Monkey测试结果分析(系列三)转
Monkey测试结果分析 一. 初步分析方法: Monkey测试出现错误后,一般的差错步骤为以下几步: 1. 找到是monkey里面的哪个地方出错 2. 查看Monkey里面出错前的一些事件动作,并手 ...
- sunos kernel src
https://github.com/eocallaghan/AuroraUX-SunOS https://github.com/zoyanhui/coroutine-libtask https:// ...
- 2017多校第10场 HDU 6172 Array Challenge 猜公式,矩阵幂
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6172 题意:如题. 解法: #include <bits/stdc++.h> using ...
- 2015多校第9场 HDU 5405 Sometimes Naive 树链剖分
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5405 题意: 给你一棵n个节点的树,有点权. 要求支持两种操作: 操作1:更改某个节点的 ...
- C基础 mariadb处理简单案例
引言 MariaDB 是一款灰常不错开源数据库. 这里直接用它来解决业务问题. 业务需求: 现在数据库中表示按照天分表的. 突然我们需要按照月来处理数据. 例如输入一个玩家id, 查找这个玩家这个月内 ...
- Leetcode 之Binary Tree Inorder Traversal(43)
树的中序遍历.先不断压入左结点至末尾,再访问,再压入右结点.注意和先序遍历的比较 vector<int> inorderTraversal(TreeNode *root) { vector ...
- linux命令(10):ps命令
1.查看mysql进程数: ps -ef | grep "mysql" | grep -v "grep" | wc –l 2.监控CPU状态:ps –au 3. ...
- [PAT] 1140 Look-and-say Sequence(20 分)
1140 Look-and-say Sequence(20 分)Look-and-say sequence is a sequence of integers as the following: D, ...
- 用ab进行POST,GET压力测试,且定义header及json的内容
这个以前没作过,找了文档.搞定. 要求时间的单curl测试的方式如下: time curl http://xxxxx/hq/restapi/isStart curl用来用post请求,且有header ...