Find minimum steps to reduce to one

Правка en1, от tatya_bichu, 2018-07-29 18:31:31

Given T test cases T<=100000 In each test case given a positive integer A. You can perform any of the following steps(one of them):. 1) decrement A by 1. 2) increment A by 1. 3) divide A by one of it's prime factor. Find minimum number of steps to reduce A to 1. 1) it is best to divide by max prime factor or finding nearest prime number whichever is minimum. This is codeforces problem but I can't find it

Теги #recursion, #primes, factor

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский tatya_bichu 2018-07-30 06:13:00 9 Tiny change: 'integer A.\nYou can ' -> 'integer A.A<=100000\nYou can '
en2 Английский tatya_bichu 2018-07-29 18:32:13 16
en1 Английский tatya_bichu 2018-07-29 18:31:31 454 Initial revision (published)