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

Автор Noufaln26, история, 9 лет назад, По-английски

suppose a set [1,5,7,10] we want to make any numbers using these element with these elements in the test,we want to make mnumbers with minimum number of operations for eg: 98=9*10+1*7+1*1 so total 10 opearation. [python,java,c,cpp]

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

»
9 лет назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

I think you can do a BFS. Each number from set is a vertex, and for each number/vertex we can find out others ones with minimum operation, each number from set is an adjacent vertex of each vertex.

»
9 лет назад, # |
Rev. 4   Проголосовать: нравится -8 Проголосовать: не нравится

Nice problem :)