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

5900번 - Cow IDs 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB250957738.308%

문제

Being a secret computer geek, Farmer John labels all of his cows with binary numbers. However, he is a bit superstitious, and only labels cows with binary numbers that have exactly K "1" bits (1 <= K <= 10). The leading bit of each label is always a "1" bit, of course. FJ assigns labels in increasing numeric order, starting from the smallest possible valid label -- a K-bit number consisting of all "1" bits. Unfortunately, he loses track of his labeling and needs your help: please determine the Nth label he should assign (1 <= N <= 10^7).

입력

  • Line 1: Two space-separated integers, N and K.

출력

제한

예제 입력 1

7 3

예제 출력 1

10110

힌트

Input Details

Among all binary numbers containing exactly 3 "1" bits, FJ wants to output the 7th in increasing sorted order.

출처

Olympiad > USA Computing Olympiad > 2011-2012 Season > USACO February 2012 Contest > Silver 2번

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

출처

대학교 대회

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

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