• 应用
• 登录
• 注册

# P3048 [USACO12FEB]牛的IDCow IDs

• 41通过
• 141提交
• 题目提供者 FarmerJohn2
• 评测方式 云端评测
• 标签 位运算,按位 组合数学 USACO 2012
• 难度 提高+/省选-
• 时空限制 1000ms / 128MB
• 提示：收藏到任务计划后，可在首页查看。

## 题目描述

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).

FJ给他的奶牛用二进制进行编号，每个编号恰好包含K 个"1" (1 <= K <= 10)，且必须是1开头。FJ按升序编号，第一个编号是由K个"1"组成。

请问第N(1 <= N <= 10^7)个编号是什么。

## 输入输出格式

输入格式：

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

输出格式：

## 输入输出样例

输入样例#1： 复制
7 3

输出样例#1： 复制
10110

提示
标程仅供做题后或实在无思路时参考。
请自觉、自律地使用该功能并请对自己的学习负责。
如果发现恶意抄袭标程，将按照I类违反进行处理。