## 10950 - Bad Code

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

Moderator: Board moderators

Dani Rodrigo
New poster
Posts: 11
Joined: Sun Jul 18, 2004 1:39 am
A code may or may not be preceded by a 0 in the encrypted string
but not can be ended with a code make of zeros.
Try this I/O:

Input:

Code: Select all

``````2
a 1
b 10
10
0
``````
Output:

Code: Select all

``````Case #1
b
``````
Note that the solution "a" is wrong because ends with a code of zeros.

shakil
Learning poster
Posts: 74
Joined: Sat Jul 15, 2006 6:28 am
Location: CUET , bangladesh
Contact:

### WHY WA?????

I got WA for this problem.Can any one help me......

Code: Select all

``Cut after AC``
Last edited by shakil on Sat May 12, 2007 6:07 pm, edited 1 time in total.
SHAKIL

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Contact:
The problem states...
A code may or may not be preceded by a 0 in the encrypted string (note the 2nd sample test case).
not zeroes. So, for the case below

Input:

Code: Select all

``````2
a 101
b 10
1000101
0``````
Output:

Code: Select all

``````Case #1
``````
Hope it helps.
Ami ekhono shopno dekhi...
HomePage

DD
Experienced poster
Posts: 145
Joined: Thu Aug 14, 2003 8:42 am
Location: Mountain View, California
Contact:

### Re:

polone wrote:I got WA too

but I think I can support some

Code: Select all

``````1
a 0
000
0
``````
I think the output should be

Code: Select all

``````Case #1
aaa
``````

hope it help
My A.C. program outputs the following result for your input:

Code: Select all

``````aaa
aa
aa
a
``````
So I guess such ambiguous input will not show in the Judge's test data.
Have you ever...
• Wanted to work at best companies?
• Struggled with interview problems that could be solved in 15 minutes?
• Wished you could study real-world problems?
If so, you need to read Elements of Programming Interviews.

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

### Re: 10950 - Bad Code

Hope follow case helps.

Code: Select all

``````2
a 10
b 1
100010
2
a 10
b 1
10031
0
``````
Accetped output:

Code: Select all

``````Case #1
aa
ba

Case #2

``````
As mentioned aboved, no character with a code equal to 0.