当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3447:Count The Keyword

题目描述
John loves various languages. Recently he begins to learn C programming language. He is interested in the keyword of C and knows the importance of keywords. So each time he gets a C program source code, he counts the the appearance of the valid keyword first. However, when the code is long, John can't count it correctly. Now he needs your help, he will give you some C code, and he wants you tell him the correct number of the appearance of the keyword.
In order to make the problem easier. John provides you some information.
1, the code don't contain "#define", i.e. the code don't contain the Macro definition .
2, the code may contain type cast, i.e. int a = (int)b;
3, the keywords in the comments are not valid.
4, the keywords in a string are not valid, and the character in the string will be expressed by letter. i.e. The string like "ab\x40" will not appear.
5, it guarantees that a word or a statement is in the same line, but one line may contain many words or statements.
6, one line contain no more than 300 characters and one word is less than 50 characters.
输入解释
The input file contains no more than 10 cases.
Each case contains a completely or incompletely correct C program and cases are separated by a line contains only four '#', i.e. "####".
输出解释
Each case outputs a number which is the sum of the Keyword appears.
输入样例
#include 
main(){
int a;
int b;
scanf("%d%d",&a,&b);
printf("%d\n",a+b);
}
输出样例
2

提示
Below is the 32 keywords in C language.
auto break case char const continue default
do double else enum extern float for
goto if int long register return short
signed static sizeof struct switch typedef union
unsigned void volatile while 
来自杭电HDUOJ的附加信息
Recommend zhouzeyong

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3447

最后修改于 2020-10-25T23:03:40+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)