10138 - CDVII

All about problems in Volume 101. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

StanG
New poster
Posts: 1
Joined: Sat Mar 05, 2011 2:33 am

10138 - CDVII

Post by StanG »

Hello.

Can anyone give me some test cases for this problem? I've tried the ones suggested in the other topic for the problem and get correct output for all of them, but still get WA when I submit it.
This is my code: http://dl.dropbox.com/u/8010985/CDVII-2_2/CDVII-2.cpp

metaphysis
Experienced poster
Posts: 139
Joined: Wed May 18, 2011 3:04 pm

Re: 10138 - CDVII

Post by metaphysis »

the judge data may contain line like this:

test 01:02:01:23 Enter 17
test 01:02:04:23 Exit 17

if you use a string variable to represent the status of car, for example:

string car_status;

then you should determine the status of car by using:

car_status[1] == 'n'
car_status[1] == 'x'

but not:

car_status == "enter"
car_status == "exit"

it wastes a lot of my time before I get AC finally.

machta
New poster
Posts: 1
Joined: Thu Jun 27, 2013 9:02 pm

Re: 10138 - CDVII

Post by machta »

metaphysis wrote: the judge data may contain line like this:

test 01:02:01:23 Enter 17
test 01:02:04:23 Exit 17
This is not true. From my experience all the test cases for this problem are well formed. So I reckon that these two lines should be skipped.

I had a problem that the long example from a previous post helped to detect. When I checked whether two successive records were from the same car, I compared the license number of the first with the corresponding part of the second record. The problem was when the first license was short and the second record began with a string that equaled the first license, then the two records were considered to be for the same car. Here is an example:

Code: Select all

1

10 10 10 10 10 10 20 20 20 15 15 15 15 15 15 15 20 30 20 15 15 10 10 10
A 01:01:01:01 enter 51 
A 01:01:01:01 enter 51 
ABC 01:01:01:01 enter 51 
ABC 01:01:04:55 exit 91 
In this case all the records were skipped and the result was a blank line. The fix was actually were easy -- I just included the space after the license numbers in the comparison so that the whole 'word' was always matched... Hope this helps anyone.

PS: The correct output is:

Code: Select all

ABC $7.00

bartekbp
New poster
Posts: 1
Joined: Sun Oct 13, 2013 7:50 pm

Re: 10138 - CDVII

Post by bartekbp »

I got WA because instead of printing "00" (as cents) my program was printing "0".

Post Reply

Return to “Volume 101 (10100-10199)”