Solved by 806 users: ...
UserDateAttemptTimeCMSC
V.A.KeRneL`21 nov 2006`Ruby100.0212
814_Vadik`22 may 2009`Ruby400.0215
kil`10 jul 2007`Ruby1300.0219
kil`10 jul 2007`Ruby1400.0219
kil`08 jul 2007`Ruby1100.0220
814_Vadik`22 may 2009`Ruby300.0221
kil`10 jul 2007`Ruby1600.0221
kil`07 jul 2007`Ruby1000.0222
fetetriste`10 apr 2007`Ruby300.0130
patronus`27 apr 2007`Python200.0633
Vego`29 oct 2006`Python500.0634
borodiy_111`13 dec 2011`Python300.0636
david_it21`15 apr 2008`Ruby100.0237
karthiekc`28 oct 2007`Ruby2000.0237
karthiekc`28 oct 2007`Ruby2100.0237
abortmozga.ru`03 jul 2010`C++500.0138
Vego`27 oct 2006`Python400.0638
 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 DevGroupThe page was generated in 210ms