Page 1 of 2

10710 - Chinese Shuffle

Posted: Sun Sep 05, 2004 3:11 pm
by ..
In the problem statement, it says that

Code: Select all

 3: 2  shuffles
 4: 2  shuffles
The shuffles for N = 4 is

Code: Select all

1 2 3 4
3 1 4 2
4 3 2 1
2 4 1 3
1 2 3 4
After 2 shuffles, the card is still in reverse order.

If I accept reverse order, I think for N = 3 to 20 is

Code: Select all

  3: 2
  4: 2
  5: 4
  6: 3
  7: 3
  8: 3
  9: 6
 10: 5
 11: 10
 12: 6
 13: 12
 14: 4
 15: 4
 16: 4
 17: 8
 18: 9
 19: 18
 20: 6
If I don't accept reverse order, I get the following values for N = 3 to 20

Code: Select all

  3: 2
  4: 4
  5: 4
  6: 3
  7: 3
  8: 6
  9: 6
 10: 10
 11: 10
 12: 12
 13: 12
 14: 4
 15: 4
 16: 8
 17: 8
 18: 18
 19: 18
 20: 6
When compared to the problem statment, my table is just one entry shifted. So could anyone tell me what's wrong??

Posted: Mon Sep 06, 2004 4:42 am
by dll
1 2 3 4
3 1 4 2
4 3 2 1
2 4 1 3
1 2 3 4


1 2 3 4
1 3 2 4 !!!
1 2 3 4

Posted: Mon Sep 06, 2004 12:42 pm
by little joey
That's right, the bottom most card always stays in place, for both odd and even values of N.

Posted: Mon Sep 06, 2004 2:50 pm
by Eduard
Please somebody tell me if my answers for this tests are right or not.
Input:

Code: Select all

1234561
12313
91
85
11111119
123213123
1233333333
3333333
200000000
55
57
-1
Output

Code: Select all

12313 is not a Jimmy-number
91 is not a Jimmy-number
85 is not a Jimmy-number
11111119 is a Jimmy-number
123213123 is not a Jimmy-number
1233333333 is not a Jimmy-number
3333333 is not a Jimmy-number
200000000 is not a Jimmy-number
55 is not a Jimmy-number
57 is not a Jimmy-number
If all of them are right please give me some else I/O.
Thanks.

10710

Posted: Tue Sep 07, 2004 9:32 am
by przygoda
Hi.
I'm looking for your help. I tried to solve problem 10710, but still i have no idea. The range of number n is very big . I see that not only prime numbers are good candidates for Jimmy-number. I found also 341,561,645,1105,.. I can't find a good method to generate all this numbers. Please give me some hints.
Martin

Posted: Tue Sep 07, 2004 10:43 am
by Krzysztof Duleba
If you have a sequence, it's a good idea to go here:

http://www.research.att.com/~njas/sequences/index.html

Posted: Tue Sep 07, 2004 11:54 am
by Minilek
isn't that like cheating?:)

Posted: Tue Sep 07, 2004 12:01 pm
by Per
Depends on whether you do it during the actual contest or not, and even then it's not very clear since there are no explicit rules (or are there?) as to what you're allowed to use.

hmm

Posted: Tue Sep 07, 2004 4:52 pm
by shahriar_manzoor
Actually in online contest one can use as much resource as he wants because all other team can do the same. That is why often online contest contains some big problems which cannot be solved in a real contest (where cut paste is not allowed).

But if you feel that you are practicing for ACM ICPC and you should follow the rules of that contest : no help from books let alone web pages and ignore the online ranklist you can do that as well. The choice is yours!

Posted: Wed Sep 08, 2004 11:26 am
by windows2k
Minilek wrote:isn't that like cheating?:)
Hello, could you give me some hints to solve the problem without cheating ?
Thx

Posted: Wed Sep 08, 2004 6:36 pm
by abishek
well all i did was to observe the examples given there.
They contain the clue i think to solve the problem. try writing a few more of the longer ones and see what happens to each number by writing out some 3-5 steps. You should get an idea. The problem is very easy and I think anything more will be a give away only
bye
abi

It's ok..

Posted: Tue Sep 21, 2004 12:04 am
by danielrocha
Your output is correct (although you skipped the first input number). Try these numbers:

Code: Select all

341
561
-1
The output should be:

Code: Select all

341 is a Jimmy-number
561 is a Jimmy-number

Posted: Tue Oct 05, 2004 8:18 pm
by little joey
In a personal message .. wrote me that he solved the problem, but was stil confused about how the cards had to be ordered after a shuffle. This is what I replied to him:
I have a little right-left dislexia, and you have to believe me, I only see this for the first time.
In the example I wrote: RIGHT: 1 2 3 4 5, LEFT: 6 7 8 9 10.
While it should realy be: LEFT: 6 7 8 9 10, RIGHT 1 2 3 4 5.
The description is not wrong, but the order of writing RIGHT and LEFT is confusing. In fact Shahriar Manzoor wrote me a PM before the contest, because he thought I made a mistake, but I just didn't see it. Sorry, but that's the my little handicap.
Let me try to make it more clear:

Code: Select all

ORIGINAL

   1 -
   2  |
   3  | these go right
   4  |
   5 -
   6 -
   7  |
   8  | these go left
   9  |
   10-

becomes:

 LEFT  RIGHT
  6      1
  7      2
  8      3
  9      4
  10     5
  
now the bottom most of the left (10) is dropped first
and is covered by the bottom most of the right (5)

 LEFT  RIGHT
  6      1
  7      2
  8      3
  9      4
  |      |
  |   5<-
   ->10
 NEW PILE

etc.
So the new pile becomes (top to bottom): 1 6 2 7 3 8 4 9 5 10
Sorry again for the confusion. Sometimes it takes a long time for someone to see a clear mistake in one's own writing...
I'm realy sorry about this.

Maybe next time I should write a problem about the colors BLUE, YELLOW and ORANGE.

Posted: Tue Oct 05, 2004 9:03 pm
by Per
little joey wrote:Maybe next time I should write a problem about the colors BLUE, YELLOW and ORANGE.
As long as the problem is about balloons, I don't mind. ;)

Posted: Wed Oct 06, 2004 6:35 am
by ..
Thanks for your reply, little joey.
I find that I take the wrong order (bottom to top) in considering a shuffle. That makes everything strange........ :oops: