#P5945. [POI 2002] 协议
[POI 2002] 协议
Background
Z works at a communications company. He is currently responsible for designing the company’s network protocol.
Problem Description
He is currently working on sending data from one computer to another through a cable.
In this cable there are different signal levels. Each second, the level changes times (we call seconds one pulse). A data packet contains consecutive pulses (that is, one packet is sent every seconds).
Due to technical reasons, the level in each packet cannot stay constant all the time; it must change multiple times. More precisely, any packet that contains a segment of consecutive pulses with the same level cannot be sent. Note that adjacent packets do not affect each other.
If there are different packets that can be sent, then a single packet contains bits of information (which may be fractional). Z wants to know the maximum number of bits that can be sent in second.
Input Format
One line with four integers: the number of levels , the pulse frequency , the packet size , and , meaning that within one packet, there must not be consecutive pulses staying at the same level; within any such length, the level must change at least once.
Output Format
Output one integer: the maximum number of bits of information that can be sent in one second, rounded down.
2 20 4 3
16
Hint
For of the testdata, , , , , and is an integer not exceeding .
Translated by ChatGPT 5