12134 - Find the Format String

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

Moderator: Board moderators

Post Reply
plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

12134 - Find the Format String

Post by plamplam »

It seemed like a simple problem at first glance, but it contained a lot of traps. I'm getting wrong answer, I can't think of any other tricky cases other than this, so a little help would be appreciated. Here are the i/o I used to test my program.

Code: Select all

5

"11" "11"

"243" "24"

"563" "56"

"784" "784"

"789" "78"

1

"A" “b"

1

"A" "A"

2

"12345" "12"
"12345" "123"

2

"12345" "123"
"12345" "12"

2

"A" "A"
"01" "10"

1

"123" "127"


1

"12345" ""

1

"ABC" ""

2

"ABC" ""
"ABC" "A"

3

"BCD" "BC"
"EFG" "EF"
"XYZ" "X"

0

Code: Select all

Case 1: [01245678]
Case 2: I_AM_UNDONE
Case 3: [0123456789A]
Case 4: I_AM_UNDONE
Case 5: I_AM_UNDONE
Case 6: I_AM_UNDONE
Case 7: I_AM_UNDONE
Case 8: [0]
Case 9: [0123456789]
Case 10: I_AM_UNDONE
Case 11: [0123456789ABCEFX]
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

Parabellum_fr
New poster
Posts: 2
Joined: Tue Sep 11, 2012 9:56 pm

Re: 12134 - Find The Format String

Post by Parabellum_fr »

Here is the inputs I have used:

Code: Select all

7
"Frites-McCain" ""
   "Machine"    "Mac"  
"nain"          "nain"
"anes"          "an"
"sangsue"       "san"
"cccp"          "ccc"
"130771"        "13"
2
"P" ""
"J" ""
1
"1" ""
2
"0" ""
"2" ""
4
"0" ""
"1" ""
"2" ""
"4" ""
2
"okkkkk" "okkkkk"
"ko"     "kokkkk"
2
"ok" "ok"
"ko" "k"
1
"A" "b"
5
"11"  "11"
"243" "24"
"563" "56"
"784" "784"
"789" "78"
1
"123abc345" "123"
2
"aa10A01aa" "aa10"
"Zazy"      "Zaz"
0
And my AC code output :

Code: Select all

Case 1: [123456789ABCDEGHIJKLMNOPQRSTUVWXYZabcdfijklmnoqrs]
Case 2: [0]
Case 3: [0]
Case 4: [1]
Case 5: [3]
Case 6: I_AM_UNDONE
Case 7: I_AM_UNDONE
Case 8: I_AM_UNDONE
Case 9: [01245678]
Case 10: [0123]
Case 11: [0123456789BCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxz]

marcinz
New poster
Posts: 2
Joined: Fri Mar 22, 2013 2:30 pm

Re: 12134 - Find The Format String

Post by marcinz »

Can someone show more tests for this problem? I am not sure, but I think that plamplam output is wrong. In case 9 my answer is [0], and in case 11 my answer is [0123456789ABCEFHIJKLMNOPQRSTUVWX]. Am I correct? My answers for Parabellum_fr input are the same.

Parabellum_fr
New poster
Posts: 2
Joined: Tue Sep 11, 2012 9:56 pm

Re: 12134 - Find The Format String

Post by Parabellum_fr »

You are right marcinz, my AC code for plamplam's test set outpouts :

Code: Select all

Case 1: [01245678]
Case 2: I_AM_UNDONE
Case 3: [0123456789A]
Case 4: I_AM_UNDONE
Case 5: I_AM_UNDONE
Case 6: I_AM_UNDONE
Case 7: I_AM_UNDONE
Case 8: [0]
Case 9: [0]
Case 10: I_AM_UNDONE
Case 11: [0123456789ABCEFHIJKLMNOPQRSTUVWX]
Maybe you're not correctly emitting the final "\n" ?
Here, the output would end with "Case 11: [0123456789ABCEFHIJKLMNOPQRSTUVWX]\n"

If you feel like it, do post an extensive inputs set and I'll post back the outputs I get.

marcinz
New poster
Posts: 2
Joined: Fri Mar 22, 2013 2:30 pm

Re: 12134 - Find The Format String

Post by marcinz »

Thank you for you reply. I found my mistake. Here are some tests which cause me problems:

Code: Select all

10
"0" ""
"1" ""
"2" ""
"3" ""
"4" ""
"5" ""
"6" ""
"7" ""
"8" ""
"9" ""
62
"0" ""
"1" ""
"2" ""
"3" ""
"4" ""
"5" ""
"6" ""
"7" ""
"8" ""
"9" ""
"A" ""
"B" "" 	
"C" ""	
"D" "" 	
"E" ""	
"F" ""
"G" ""	
"H" ""	
"I" ""	
"J" ""	
"K" ""	
"L" ""	
"M" ""
"N" ""
"O" ""
"P" ""
"Q" ""
"R" ""
"S" ""
"T" ""	
"U" ""	
"V" "" 	
"W" ""
"X" ""	
"Y" ""
"Z" ""
"a" "" 	
"b" ""	
"c" ""	
"d" ""	
"e" ""
"f" ""	
"g" ""	
"h" ""	
"i" ""	
"j" ""
"k" ""	
"l" ""	
"m" ""	
"n" ""	
"o" ""	
"p" ""	
"q" ""	
"r" ""	
"s" ""	
"t" ""	
"u" ""	
"v" ""	
"w" ""	
"x" ""	
"y" ""	
"z" ""
0
Output

Code: Select all

Case 1: [A]
Case 2: I_AM_UNDONE

Post Reply

Return to “Volume 121 (12100-12199)”