F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Is It a Number

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1468    Accepted Submission(s): 514


Problem Description
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.
 

Input
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.
 

Output
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.
 

Sample Input
5 0123 123.456 0.456E-5 123 456 0.456EF
 

Sample Output
YES YES YES NO NO
 

Author
Ignatius.L
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-26 07:13:50, Gzip enabled