Logo
(追記) (追記ここまで)

23519번 - Negative Base 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 512 MB28211770.833%

문제

It is known that the binary positional numeral system works as follows: denoting a nonnegative integer $x$ as a string "$x_k \ldots x_2 x_1 x_0$" of zeroes and ones means that $x = x_k \cdot 2^k + \ldots + x_2 \cdot 2^2 + x_1 \cdot 2^1 + x_0 \cdot 2^0$. The leading zeroes are omitted, so $x_k = 1,ドル except the case when $x = 0$ which is denoted as "0ドル$".

The negabinary notation works in a similar way: denoting an number $x$ as a string "$x_k \ldots x_2 x_1 x_0$" of zeroes and ones means that $x = x_k \cdot (-2)^k + \ldots + x_2 \cdot (-2)^2 + x_1 \cdot (-2)^1 + x_0 \cdot (-2)^0$. The leading zeroes are also omitted, so $x_k = 1,ドル except the case when $x = 0$ which is denoted as "0ドル$". It turns out that this notation has a unique representation for every integer (as opposed to only nonnegative integers).

Negabinary notation of numbers from $-7$ to 8ドル$:

$-7$ 1001ドル$ 1ドル$ 1ドル$
$-6$ 1110ドル$ 2ドル$ 110ドル$
$-5$ 1111ドル$ 3ドル$ 111ドル$
$-4$ 1100ドル$ 4ドル$ 100ドル$
$-3$ 1101ドル$ 5ドル$ 101ドル$
$-2$ 10ドル$ 6ドル$ 11010ドル$
$-1$ 11ドル$ 7ドル$ 11011ドル$
0ドル$ 0ドル$ 8ドル$ 11000ドル$

Given an integer $k,ドル find a number which has at least $k$ consecutive zeroes in its negabinary representation. Of all such numbers, find the one which has the least absolute value. If there are still several answers, pick the one with the shortest negabinary representation.

입력

The first line of input contains an integer $k$ (1ドル \le k \le 30$).

출력

Print one integer: the answer to the problem.

제한

예제 입력 1

2

예제 출력 1

4

힌트

출처

Contest > Open Cup > 2018/2019 Season > Stage 17: Grand Prix of Baltic Sea I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /