Type: Default 1000ms 512MiB

Amount of Degrees

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

原题来自:NEERC 2000 Central Subregional,题面详见 Ural 1057

求给定区间 [X,Y][X,Y] 中满足下列条件的整数个数:这个数恰好等于 KK 个互不相等的 BB 的整数次幂之和。例如,设 X=15,Y=20,K=2,B=2X=15,Y=20,K=2,B=2,则有且仅有下列三个数满足题意:

17=24+2018=24+2120=24+22\begin{align} 17&=2^4+2^0 \\ 18&=2^4+2^1 \\ 20&=2^4+2^2 \end{align}

输入格式

第一行包含两个整数 XXYY,接下来两行包含整数 KKBB

输出格式

只包含一个整数,表示满足条件的数的个数。

样例

15 20
2
2
3

数据范围与提示

对于全部数据,1XY2311,1K20,2B101\le X\le Y\le 2^{31}-1,1\le K\le 20,2\le B\le 10

4月第四周昆十中教研

Not Claimed
Status
Done
Problem
12
Open Since
2026-5-11 0:00
Deadline
2026-5-28 23:59
Extension
24 hour(s)