10081_ParsingRealNumbers

2022-5-16 18:16| 发布者: Hocassian| 查看: 87| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504524262300-Problem List-采集的数据-后羿采集器.html

Pro.ID

10081

Title

Parsing Real Numbers

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=10081

AC

5

Submit

28

Ratio

17.86%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    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.

    输出

    Description

    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.

    Input

    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.

    Output

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

    Sample Input
    2
     1.5e+2
    3.
    Sample Output
    LEGAL
    ILLEGAL
    Source

    样例输入

    2
     1.5e+2
    3.

    样例输出

    LEGAL
    ILLEGAL

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部