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

建议使用的浏览器:

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

1537:Identifying Legal Pascal Real Constants

题目描述
Pascal requires that real constants have either a decimal point, or an exponent (starting with the letter e or E, and officially called a scale factor), or both, in addition to the usual collection of decimal digits. If a decimal point is included it must have at least one decimal digit on each side of it. As expected, a sign (+ or -) may precede the entire number, or the exponent, or both. Exponents may not include fractional digits. Blanks may precede or follow the real constant, but they may not be embedded within it. Note that the Pascal syntax rules for real constants make no assumptions about the range of real values, and neither does this problem.

Your task in this problem is to identify legal Pascal real constants.
输入解释
Each line of the input data contains a candidate which you are to classify.
输出解释
For each line of the input, display your finding as illustrated in the example shown below. The input terminates with a line that contains only an asterisk in column one.
输入样例
1.2
   1.
  1.0e-55
  e-12
    6.5E
     1e-12
  +4.1234567890E-99999
   7.6e+12.5
99
*
输出样例
1.2 is legal.
1. is illegal.
1.0e-55 is legal.
e-12 is illegal.
6.5E is illegal.
1e-12 is legal.
+4.1234567890E-99999 is legal.
7.6e+12.5 is illegal.
99 is illegal.

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

源链接: POJ-1537

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

共提交 0

通过率 --%
时间上限 内存上限
1000 10000