Блог пользователя saba_tavdgiridze

Автор saba_tavdgiridze, 11 лет назад, По-английски

Hello everybody.I'm looking at this problem and I've no idea how to solve it. It's about that,with minimum number of 1's and operations of addition, multiplication and parenthesis you must obtain positive number n.

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

»
11 лет назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

I think it can help you

So, suppose we know this minimum for all 1 <= i < n. (If n == 1, answer is 1). How can we get n? Only by addition or multiplication. So, answer[n] = minimum(answer[a] + answer[b] | a + b == n or a * b == n, a < n, b < n)