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 =)