luogu#P5035. 金坷垃
金坷垃
Background
Originally created by @rainheavy.
This is a very (du) easy (liu) problem.
The 1st China International Import Expo was held in Shanghai from 2018.11.5 to 2018.11.10. The country ruled by Trump, the “beautiful country” (Meiliguo, pinyin), brought Jinkela. This is a magical product. According to their advertisements: if you use Jinkela fertilizer, it can absorb nitrogen, phosphorus, and potassium from depths below 20 meters.
However, when it was inspected by the quality inspector DevZhu from “Futukang” (pinyin), some problems were found. The effect of Jinkela was not as the advertisement said. After all, plant roots can only reach depth , so the effect of Jinkela is limited.
Problem Description
It only has the following effect (take as an example).
The proper divisors of are .
From a depth of meters underground, you can jump upward by a length equal to one divisor. (For example, .)
Now it is at depth meters. The proper divisors of are .
Jump another to reach . The proper divisors of are .
Jump to reach . The proper divisors of are .
has already been used, so it cannot be used again.
Jump another to reach . The proper divisors of are .
has already been used, so it cannot jump anymore. The final depth is .
Following the rules above, try all possible jump sequences that are allowed. If there exists at least one sequence whose final result is , then this fertilizer is qualified; otherwise it is not qualified.
DevZhu is facing a large pile of Jinkela to be tested and does not want to test so many. He wants to ask which Jinkela are qualified, and among these qualified ones, which one is the -th by initial depth.
Sort the qualified Jinkela by initial depth from small to large. Output the initial depth of the -th qualified Jinkela modulo . (Futukang never uses or .)
Input Format
One number .
Output Format
Output the initial depth of the -th qualified Jinkela modulo .
1
1
2
2
Hint
(It is super easy...)
(A little benefit for those who cannot do it: there is one testdata with .)
Constraints:
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5