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

建议使用的浏览器:

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

3332:Parsing Real Numbers

题目描述

Write a program that read a line of input and checks if the line contains a valid real number. Real numbers may have a decimal point, an exponent (starting with the character e or E), or both. Additionally, it has the usual collection of decimal digits. If there is a decimal point, there must be at least one digit on each side of the point. There may be a plus or minus sign in front of the number, or the exponent, or both (without any blank characters after the sign). Exponents are integers (not having decimal points). There may be blank characters before or after a number, but not inside it. Note that there is no bound on the range of the numbers in the input, but for the sake of simplicity, you may assume the input strings are not longer than 1000 characters.

输入解释

The first line of the input contains a single integer T which is the number of test cases, followed by T lines each containing the input line for a test case.

输出解释

The output contains T lines, each having a string which is LEGAL or ILLEGAL.

输入样例
2
  1.5e+2
3.
输出样例
LEGAL
ILLEGAL

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3332

最后修改于 2020-10-29T06:59:03+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536