I think i still need some more case to pass.. cause my code passed all the previous case but still wA..
some one plz help me with test case for this program..
These are the steps that i followed to detect illegal input:
* Check whether the first character is e or E (without space, +, -)
* Check whether the last number is e(without spaces in the last).
* Check whether there is multiple e.
* Check whether there is dots '.' after e.
* Check whether there is any space inside the numbers.
* Check whether the dot '.' is the fast or last character.
* Check whether there is number on both side of the '.' dot.
* Check whether there is a '.' dot or 'e' or 'E' in the whole input.
* Check if there is a blank line then it is straight "is illegal."
>> And i reduced all the leading and trailing space.. If there is more then one space inside the input then i reduced it to single 1.
Is there any thing more to do?
325 - Identifying Legal Pascal Real Constants
Moderator: Board moderators
Re: WA~ problem 325 Identifying Legal Pascal Real Constants
try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
Re: 325 DFA? WHY WA?
To:Jorge Pinto
problem stayement says:
problem stayement says:
So is there any input like 1 .2Blanks may precede or follow the real constant, but they may not be embedded within it
Re: WA~ problem 325 Identifying Legal Pascal Real Constants
So, this problem's a bit tricky.
First, if you observe the sample input carefully, notice that the leading spaces are trimmed. So, for example, if this the input is
then the AC output is
Next, it appears that the judge's input might not have trailing spaces - or if it does, then either trimming those trailing spaces or leaving them in the output gives AC. In my program, I trim the trailing spaces most of the time. So, for example, if the input's (with 4 trailing spaces)
Then my AC program produces the following output
Note that the trailing whitespaces are trimmed in the output.
However, in the following case (when there's a space in between the constant)
My AC program produces the following output (without trimming the trailing spaces - but always trimming the leading spaces)
Also, it wasn't clear to me from reading the problem statement what the AC output for the following input should be
The AC Output is
Finally, junbin's test case helped me out. So here it is without the underscores - and the AC output.
Input:
AC Output:
First, if you observe the sample input carefully, notice that the leading spaces are trimmed. So, for example, if this the input is
Code: Select all
+4.1234567890E-99999
*
Code: Select all
+4.1234567890E-99999 is legal.
Code: Select all
+7.2
*
Code: Select all
7.2 is legal.
However, in the following case (when there's a space in between the constant)
Code: Select all
E455555555 676
*
Code: Select all
E455555555 676 is illegal.
Code: Select all
44343e112
*
Code: Select all
44343e112 is legal.
Input:
Code: Select all
k s jhsfdkkjsa df sadf s
dsfgh sdf gk dsf
2 2 3443 457 65
2e3e2e2
+e-2
+2-1
+2e-2
+2e+2
-2e-1-1
442
3465374657846358634563865923569548236458263458623562835682346582364582364
34653746578463_5863456386592356_95482364582634586235_62835682346582364582364
45643856
4353 e 546456
456456e345345
462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576
462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576+
462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576-
+462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576
462976592798713405193549823645926395628346589236458946e+4569223458726348563256238465872465876324576
-462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576
462976592798713405193549823645926395628346589236458946e-4569223458726348563256238465872465876324576
+462976592798713405193549823645926395628346589236458946e-4569223458726348563256238465872465876324576
-462976592798713405193549823645926395628346589236458946e+4569223458726348563256238465872465876324576
12e21
435e231e123e213
23e+355-14
+234+e234+E1234
3.2
459679346834596734956739476984396739476972394571936459823645863195629384658723653245235.37563286583645162847686587436587632475
457693476987495864364.5645634564564356e4563564564356543
457693476987495864364.5645634564564356e+4563564564356543
457693476987495864364.5645634564564356e-4563564564356543
+457693476987495864364.5645634564564356e4563564564356543
-457693476987495864364.5645634564564356e4563564564356543
457693476987495864364.+5645634564564356e4563564564356543
457693476987495864364.-5645634564564356e4563564564356543
*
Code: Select all
k s jhsfdkkjsa df sadf s is illegal.
dsfgh sdf gk dsf is illegal.
is illegal.
2 2 3443 457 65 is illegal.
2e3e2e2 is illegal.
+e-2 is illegal.
+2-1 is illegal.
+2e-2 is legal.
+2e+2 is legal.
-2e-1-1 is illegal.
442 is illegal.
3465374657846358634563865923569548236458263458623562835682346582364582364 is illegal.
34653746578463_5863456386592356_95482364582634586235_62835682346582364582364 is illegal.
45643856 is illegal.
4353 e 546456 is illegal.
456456e345345 is legal.
462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576 is legal.
462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576+ is illegal.
462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576- is illegal.
+462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576 is legal.
462976592798713405193549823645926395628346589236458946e+4569223458726348563256238465872465876324576 is legal.
_-462976592798713405193549823645926395628346589236458946e4569223458726348563256238465872465876324576 is illegal.
462976592798713405193549823645926395628346589236458946e-4569223458726348563256238465872465876324576 is legal.
+462976592798713405193549823645926395628346589236458946e-4569223458726348563256238465872465876324576 is legal.
-462976592798713405193549823645926395628346589236458946e+4569223458726348563256238465872465876324576 is legal.
12e21 is legal.
435e231e123e213 is illegal.
23e+355-14 is illegal.
+234+e234+E1234 is illegal.
3.2 is legal.
459679346834596734956739476984396739476972394571936459823645863195629384658723653245235.37563286583645162847686587436587632475 is legal.
457693476987495864364.5645634564564356e4563564564356543 is legal.
457693476987495864364.5645634564564356e+4563564564356543 is legal.
457693476987495864364.5645634564564356e-4563564564356543 is legal.
+457693476987495864364.5645634564564356e4563564564356543 is legal.
-457693476987495864364.5645634564564356e4563564564356543 is legal.
457693476987495864364.+5645634564564356e4563564564356543 is illegal.
457693476987495864364.-5645634564564356e4563564564356543 is illegal.
-
- Experienced poster
- Posts: 139
- Joined: Wed May 18, 2011 3:04 pm
Re: 325 - Identifying Legal Pascal Real Constants
For WA, try input:
output:
by the way, trim the leading and tailing space(Maybe the input of judge contain non tailing space). Use regex for this problem is easy.
Code: Select all
000040040.001200E-000000123
0e-0
*
Code: Select all
000040040.001200E-000000123 is legal.
0e-0 is legal.
metaphysis: http://uhunt.onlinejudge.org/id/95895
My solutions for UVa problems: https://github.com/metaphysis/Code.
My solutions for UVa problems: https://github.com/metaphysis/Code.