0
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only
Petya has a number consisting of n digits without leading zeroes. He represented it as an array of digits without leading zeroes. Let's call it d. The numeration starts with 1, starting from the most significant digit. Petya wants to perform the following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx + 1 = 7. Note that if no x was found, then the operation counts as completed and the array doesn't change at all.
1 Réponse
0
You can't just give a question and get the answer. Show your attempt, ask where you got stuck exactly, then you'll get many answers. All the best =)