Noufaln26's blog

By Noufaln26, history, 9 years ago, In English

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]

  • Vote: I like it
  • -3
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

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 years ago, # ^ |
      Vote: I like it -11 Vote: I do not like it

    Can you provide me code/algorithm to do it?

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      it's better you to try to code it, isn't it?

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      where is the problem from?

      • »
        »
        »
        »
        9 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        this is from an ongoing competition .. www.tcscodevita.com .. (I can just copy paste this comment to atleast 4-5 recent blogs on cf. :\ )

»
9 years ago, # |
Rev. 4   Vote: I like it -8 Vote: I do not like it

Nice problem :)