Cow IDs
의견: 0
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.
The Nth label (in binary) that FJ should assign.
cowids.incowids.out7 310110Input details: Among all binary numbers containing exactly 3 "1" bits, FJ wants to output the 7th in increasing sorted order.
riseoj 작성
출처 올림피아드 > USACO > 2011-2012 > February > Silver
평가 및 의견
Cow IDs
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Cow IDs