CSES - Josephus Problem I

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 512M
Input: stdin
Output: stdout

Nguồn bài:
https://cses.fi/problemset/task/2162
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Consider a game where there are ~n~ children (numbered ~1,2,\dots,n~) in a circle. During the game, every other child is removed from the circle until there are no children left. In which order will the children be removed?

Input

  • The only input line has an integer ~n~.

Output

  • Print ~n~ integers: the removal order.

Constraints

  • ~1 \le n \le 2 \cdot 10^5~

Example Input

7

Example Output

2 4 6 1 5 3 7

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.