QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB Total points: 10

#10646. Dwójkowy zbijak [A]

统计

Bituś 和 Bajtuś 正在玩“双倍击打”游戏。游戏在一个由 $n$ 个格子组成的棋盘上进行,这些格子从 $1$ 到 $n$ 编号。每个格子上都有一个棋子。两名玩家轮流行动。每次行动是将编号为 $i$ 的格子上的棋子取下,并把它移动到编号为 $2^{k}i$ 的格子上,这里的 $k \ge 1$ 可以任意选择,只要目标格子存在。如果新格子上已经有棋子,则发生“互相击打”,两个棋子都从游戏中被移除。无法行动的玩家判负。

每次都是 Bituś 准备棋盘(也就是选择一个正整数 $n$),并大方地把先手权让给 Bajtuś。但 Bituś 不喜欢输,所以他总是选择一个让后手玩家有必胜策略的棋盘。例如,长度为 1、10 或 11 的棋盘就满足这个条件。但他又不希望 Bajtuś 起疑,所以每次都要选不同大小的棋盘。

因此他请求你帮忙。请写一个程序,对于给定的 $k$,输出第 $k$ 大(按递增顺序)的、保证后手玩家有必胜策略的棋盘大小。

输入格式

输入的唯一一行包含一个整数 $k$($1 \le k \le 1,000,000,000$)。

输出格式

输出的唯一一行应为第 $k$ 大保证后手玩家获胜的棋盘的大小。

样例

输入

2

输出

10
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.