11604 - General Sultan

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

Moderator: Board moderators

HIT_Nessie
New poster
Posts: 6
Joined: Wed Nov 19, 2008 8:08 am

11604 - General Sultan

My basic idea about this problem is that, given n strings(the weapon's code) and judge if one string is composite by other string.
I use dp to solve this problem but I got WA...
I don't know whether I have a misunderstanding on this problem...Plz help me, thx in advance

Chirag Chheda
Learning poster
Posts: 74
Joined: Sat Jun 21, 2008 12:24 pm
Location: India

Re: 11604 General Sultan

Consider the case 1+110 == 11 + 10.
The output for the above case should be ambiguous.
Hope it helps.
Last edited by Chirag Chheda on Sun Apr 12, 2009 12:45 pm, edited 1 time in total.

HIT_Nessie
New poster
Posts: 6
Joined: Wed Nov 19, 2008 8:08 am

Re: 11604 General Sultan

Chirag Chheda wrote:Consider the case 1+110 == 1 + 10.
The output for the above case should be ambiguous.
Hope it helps.
Sorry, I don't quite understand. Could you please explain it in details? Thanks very much..

Chirag Chheda
Learning poster
Posts: 74
Joined: Sat Jun 21, 2008 12:24 pm
Location: India

Re: 11604 General Sultan

Try the following input

Input

Code: Select all

``````4
a 1
b 110
c 11
d 10
0
``````
Output

Code: Select all

``````Case #1: Ambiguous.
``````

LayCurse
New poster
Posts: 11
Joined: Sun Feb 25, 2007 3:14 pm
Location: Kyoto, Japan

Re: 11604 General Sultan

The another example is following:
4
a 00
b 11
c 001
d 100
0
The correct answer is Ambiguous, because 001100=cd(001+100)=aba(00+11+00).

HIT_Nessie
New poster
Posts: 6
Joined: Wed Nov 19, 2008 8:08 am

Re: 11604 General Sultan

Thx for help, I got ac:). I did have a misunderstanding of this problem.

Hasanaa
New poster
Posts: 1
Joined: Sun Sep 14, 2008 9:17 am

Re: 11604 - General Sultan

I'm getting RE pls help me ... Why ...

Code: Select all

``````AC...
``````

yifenfei
New poster
Posts: 1
Joined: Wed Jun 24, 2009 11:25 am

Re: 11604 - General Sultan

How to slove it, i have no idea at all. Can anyone show me the algorithm or code about it? Thank you!