HDU_2024——判断字符串是否是c语言合法标识符
#include <cstdio>
#include <cctype>
int main()
{
int n,i;
char str[];
scanf("%d",&n);
while(n--)
{
fflush(stdin);
gets(str);//scanf不读空格
bool flag=true;
for(i=;str[i];i++)
{
if((i==&&(str[i]>=''&&str[i]<='')) || (!((str[i]>=''&&str[i]<='') || (str[i]=='_') || (str[i]>='a'&&str[i]<='z') || (str[i]>='A'&&str[i]<='Z'))))
{
flag=false;
break;
}
}
printf(flag?"yes\n":"no\n");
}
return ;
}
HDU_2024——判断字符串是否是c语言合法标识符的更多相关文章
- HDOJ2024C语言合法标识符
C语言合法标识符 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Su ...
- 1164: 零起点学算法71——C语言合法标识符(存在问题)
1164: 零起点学算法71——C语言合法标识符 Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 10 ...
- C语言合法标识符 题解
输入一个字符串,判断其是否是C的合法标识符. Input输入数据包含多个测试实例,数据的第一行是一个整数n,表示测试实例的个数,然后是n行输入数据,每行是一个长度不超过50的字符串. Output对 ...
- 杭电2024 C语言合法标识符
链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2024 开始真的对这题是一点头绪都没有,简直了.然后事实证明是我想多了,这题主要是把概念给弄清楚 ...
- HDU 2024 C语言合法标识符
http://acm.hdu.edu.cn/showproblem.php?pid=2024 Problem Description 输入一个字符串,判断其是否是C的合法标识符. Input 输入 ...
- Problem J: 零起点学算法105——C语言合法标识符
#include<stdio.h> #include<ctype.h>//调用isalpha函数 int main() { int n; ]; while(scanf(&quo ...
- C语言合法标识符(hud2024)
输入方式:先输入一个整型,再循环输入带空格的字符串. 思考:整型用scanf_s()输入.大循环输入字符串前用getchar()函数读取缓冲区的字符.然后,输入带空格的字符串就要用”gets_s()“ ...
- hdu2024C语言合法标识符
#include<iostream> #include<stdio.h> #include<math.h> #include<stdlib.h> #in ...
- c语言合法标识符
#include <iostream>#include <stdio.h>using namespace std;char str[100][51];int main() { ...
随机推荐
- gzip优化网络传输量提高传输效率[转]
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;us ...
- Android 仿Win8的metro的UI界面(上)
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/23441455 昨晚没事手机下载了一些APP,发现现在仿win8的主界面越来越多, ...
- Chapter 8. Introduction to multi-project builds 多工程构建介绍
Only the smallest of projects has a single build file and source tree, unless it happens to be a mas ...
- git pull 代码很慢的问题
办公环境调整,之前开发机是和自己的电脑放同一网段内的,现在开发机放至到本地其他网段内,造成pull 代码很慢的问题,在网上查了一下 以下是原文,链接为 http://blog.sina.com.cn/ ...
- VideoView 视频播放 示例
介绍 实现的功能: 可播放本地视频或网络视频,可控制播放或暂停 最小化时保存播放位置及播放状态,resume时恢复所有状态: 横竖屏切换时保持切换前的位置及状态 在屏幕上竖直滑动可调节屏幕亮度和音量 ...
- bzoj 3043 (差分序列运用)
维护差分序列 显然要使差分序列的后n-1位为0 对于原来的区间操作 只需要单点修改或者两个点修改 就转化成了 对于差分序列但以一个数+ 或 - 或者一个+1同时一个- ans1=max(sum1,su ...
- C#第一节课
1,命名规范 A.如果声明一个变量,小写,如果有多个单词,后面首字母大写 如: string sString="aa"; int iNum=20; bool bMale=false ...
- 阿里巴巴iconfont使用方式
IconFont的作用就是用字体的格式来取代图片.特殊字体的展示,用得比较多的就是一些纯色的图标,具体主要由当前css3属性里的自定义字体(@font-face)来实现. 1.首先在Iconfont- ...
- HTML中常用鼠标样式
语法:cursor : auto | all-scroll | col-resize| crosshair | default | hand | move | help | no-drop | not ...
- c - 2/1, 3/2, 5/3, 8/5, 13/8...前20项的和
double pres(const int n) { ; //分子. ; //分母. ; double tmp; ; i <= n; i++) { sum += (numerator / den ...