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

建议使用的浏览器:

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

1409:Is It a Number

题目描述
In some programming languages(like C/C++), we define numbers like this:

number -> digits optional_fraction optional_exponent
optional_fraction -> [empty] | .digits
optional_exponent -> [empty] | E digits | E - digits
digits -> digit | digits digit
digit -> [0-9]

Given a string, you have to tell whether it is a legal number.
输入解释
The first line of input contains an integer T(1<=T<=100) which indicate the number of test cases. Then T test cases follow. Each test case contains one line. Each line contains a string whose length will not exceed 100.

Note: there are no spaces and tabs at the begin and the end of the string.
输出解释
For each test case, you have to tell whether the string is a legal number. If it is a legal number, output "YES" in a single line, otherwise, output "NO" in a single line.
输入样例
5
0123
123.456
0.456E-5
123 456
0.456EF
输出样例
YES
YES
YES
NO
NO
来自杭电HDUOJ的附加信息
Author Ignatius.L
Recommend lxj

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

源链接: HDU-1409

最后修改于 2020-10-25T22:44:42+00:00 由爬虫自动更新

共提交 247

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