A10721 | Igor and Interesting Numbers
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Igor likes hexadecimal notation and considers positive integer in the hexadecimal notation interesting if each digit and each letter in it appears no more than $t$ times. For example, if $t=3$ , then integers 13a13322, aaa, abcdef0123456789 are interesting, but numbers aaaa, abababab and 1000000 are not interesting.
Your task is to find the $k$ -th smallest interesting for Igor integer in the hexadecimal notation. The integer should not contain leading zeros.
Your task is to find the $k$ -th smallest interesting for Igor integer in the hexadecimal notation. The integer should not contain leading zeros.
输入格式
The first line contains the two integers $k$ and $t$ ( $1<=k<=2·10^{9}$ , $1<=t<=10$ ) — the number of the required integer and the maximum number of times some integer or letter can appear in interesting integer.
It can be shown that the answer always exists for such constraints.
It can be shown that the answer always exists for such constraints.
输出格式
Print in the hexadecimal notation the only integer that is the $k$ -th smallest interesting integer for Igor.
输入输出样例
输入 #1
17 1
输出 #1
12
输入 #2
1000000 2
输出 #2
fca2c
The first 20 interesting integers if $t=1$ : 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, 10, 12, 13, 14, 15. So the answer for the first example equals 12.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted