10395 - Titans in Danger

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

Moderator: Board moderators

inteplus
New poster
Posts: 4
Joined: Fri Oct 26, 2001 2:00 am
Location: NTU Singapore
Contact:

Post by inteplus »

Yes, weird description.

I guess this is what the author hid.
Suppose you use recursive function f(n) to generate permutations of the first n Titans. When you decide which guy to swap with the rightmost.
- n odd: Make the leftmost guy happy.
- n even: Blindly select one-by-one, left-to-right.

Thanks to Adrian and Snap. I got AC.
windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

Post by windows2k »

inteplus wrote: Suppose you use recursive function f(n) to generate permutations of the first n Titans. When you decide which guy to swap with the rightmost.
- n odd: Make the leftmost guy happy.
- n even: Blindly select one-by-one, left-to-right.
Sorry , I don't understand what you mean :(
Could you explain more clearly , or take "abcd" for example
thx in advance :)
gagern
New poster
Posts: 7
Joined: Thu Mar 11, 2004 5:37 pm

Post by gagern »

See also Topic 1866.

I also tried this simple recursion:

Code: Select all

perm(0): output current
perm(i): perm(i-1);
         for j=1 to i: swap 0 and i;
                       perm(i-1);
Result: some permutations occur several times, up to 36. Thus others must be missing.

Greetings!
inva1id
New poster
Posts: 1
Joined: Wed Mar 12, 2008 10:49 pm

10395

Post by inva1id »

Arighty! Finally got accepted on my own... This thread can be deleted
Post Reply

Return to “Volume 103 (10300-10399)”