#P9134. [THUPC 2023 初赛] 拧螺丝

[THUPC 2023 初赛] 拧螺丝

Background

Zhang Hua was admitted to Peking University; Li Ping entered a secondary technical school; Little E is moving bricks at a construction site: they all have a bright future.

Because moving bricks is too tiring, Little E decides to work in a factory tightening screws. However, Little E meets a boss who always tries to make things difficult.

Problem Description

To produce one module, nn screws must be tightened. However, every 1010 minutes, Little E's boss will come to Little E's workstation and take away one unfinished module. During each such period, Little E only has enough time to tighten kk screws.

Little E's boss has just left. Ask: on which upcoming visit (the xx-th time) is it possible for Little E to have a finished module? Assume Little E's boss tries as hard as possible to prevent Little E from achieving this.

Input Format

One line with two positive integers, n,kn,k.

Output Format

If Little E can never have a finished module no matter what, output one line Poor E.S.!.

Otherwise output one line with one positive integer, the answer.

3 2

2

Hint

Sample Explanation 1

Little E first chooses two modules and tightens one screw on each of them. Then the boss comes and takes away one. Next, Little E only needs to tighten two more screws on the remaining module to finish it. So when the boss comes the second time, Little E already has one finished module. Note that when the boss comes, Little E cannot have a module with screws only half-tightened; otherwise, the boss will see it and say Little E's work is unqualified.

Subtasks

It is guaranteed that 1kn1051\le k \le n \le 10^5.

Source

From the preliminary round of the 2023 Tsinghua University Student Algorithmic Contest and Intercollegiate Invitational (THUPC2023).

Resources such as solutions can be found at https://github.com/THUSAAC/THUPC2023-Pre.

Translated by ChatGPT 5