## 10710 - Chinese Shuffle

Moderator: Board moderators

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong

### 10710 - Chinese Shuffle

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??
My signature:
We can learn much more in discussion than reading source code.
• I HATE testing account.
• Don't send me source code for debug.

dll
New poster
Posts: 16
Joined: Fri Oct 17, 2003 9:51 am
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
Nothing is impossible

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm
That's right, the bottom most card always stays in place, for both odd and even values of N.

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan
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.
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

przygoda
New poster
Posts: 7
Joined: Fri Aug 09, 2002 12:26 pm
Location: Poland

### 10710

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

Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:
If you have a sequence, it's a good idea to go here:

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

Minilek
Learning poster
Posts: 90
Joined: Tue Jul 27, 2004 9:34 am
Location: Cambridge, MA
Contact:
isn't that like cheating?:)

Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden
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.

shahriar_manzoor
Posts: 399
Joined: Sat Jan 12, 2002 2:00 am

### hmm

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!

windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan
Minilek wrote:isn't that like cheating?:)
Hello, could you give me some hints to solve the problem without cheating ?
Thx

abishek
Experienced poster
Posts: 131
Joined: Mon Dec 15, 2003 5:41 am
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

danielrocha
New poster
Posts: 44
Joined: Sun Apr 27, 2003 3:17 am
Location: Rio Grande do Norte - Brazil
Contact:

### It's ok..

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
``````
Daniel
UFRN HDD-1
Brasil

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm
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...

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

Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden
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.

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong