#E. 猴子选大王

    Type: Default 1000ms 256MiB

猴子选大王

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

n只猴子选大王,选举办法如下:从头到尾1,2,3报数,凡报3的退出,余下猴子第二轮从尾到头1,2,3报数,凡报3的退出...如此类推,当剩下两只猴子时,取这时报1的为王,若想当猴王,请问当初应占据什么位置?

Input Format

一个数 n,表示n只猴子 n<=1000 .

Output Format

一个整数,表示猴王的位置,也就是最后一个出队的猴子的位置。

Sample

input

3

===================下面为第二组======================

7

output

2

===================下面为第二组======================

2

Hint

时间限制:1s1 \text {s}

空间限制:256MB256 \text {MB}

JZYZ2020夏令营Round2

Not Attended
Status
Done
Rule
OI
Problem
5
Start at
2020-8-11 11:35
End at
2020-8-11 13:00
Duration
1.4 hour(s)
Host
Partic.
21