<PREV Problem:
NEXT>
Solved by 806 users: ...
UserDateAttemptTimeCMSC
V.A.KeRneL21 nov 2006Ruby100.0212 
814_Vadik22 may 2009Ruby400.0215 
kil10 jul 2007Ruby1300.0219 
kil10 jul 2007Ruby1400.0219 
kil08 jul 2007Ruby1100.0220 
814_Vadik22 may 2009Ruby300.0221 
kil10 jul 2007Ruby1600.0221 
kil07 jul 2007Ruby1000.0222 
fetetriste10 apr 2007Ruby300.0130 
patronus27 apr 2007Python200.0633 
Vego29 oct 2006Python500.0634 
borodiy_11113 dec 2011Python300.0636 
david_it2115 apr 2008Ruby100.0237 
karthiekc28 oct 2007Ruby2000.0237 
karthiekc28 oct 2007Ruby2100.0237 
abortmozga.ru03 jul 2010C++500.0138 
Vego27 oct 2006Python400.0638 
Languages
C++
347
FPC
232
C
132
Java
41
Kylix
41
Ruby
16
Python
11
Lua
2
Perl
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Circle Game

Time limit = 1

Let's consider circle game. From N children, numbered 1, 2, ..., N, standing in circle every M-th is going to be removed from circle and only the last child will be the winner. For example when N = 6 and M = 5 then the children will be removed in the order 5, 4, 6, 2, 3 and 1 will be winner.

There are two teams playing the game. Each team consists of K children. In the circle the first K children are from the first team and the last K children from the second one. You have to determine such minimal M that all the players of the second team will be removed before the children of the first team.

Input The input consists of one line, containing K. 0 < K < 14.

Output The output should contain M.

Input#1
4
Output#1
30

Author:
Student olympiad in Khmelnitski, March 2003
24 april 2003

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 190ms

SW soft NIX
ID = 3.226.248.180