2023-2024 ICPC, Swiss Subregional |
---|
Finished |
In the mystical land of District 42, where life, the universe, and everything is just a little bit odd, residents ponder a curious question. They observe the sequence of numbers $$$1, 2, 3, \dots, n$$$ without leading zeros or commas. Their quest is to determine how many times the mystical number $$$42$$$ appears within this sequence.
The only line of the input contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$), the length of the sequence.
Print one integer — number of times $$$42$$$ appears.
24
0
25
1
250
9
In the second example, the sequence is $$$1234567891011\dots2{\bf 42}5$$$, at which point $$$42$$$ appears for the first time.
Name |
---|