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]
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]
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.
Can you provide me code/algorithm to do it?
it's better you to try to code it, isn't it?
ya..it's better. i had to apply that in some other problem,but i think you could say that how complex the problem is?
Take a look at:
http://ideone.com/Xec19L
where is the problem from?
this is from an ongoing competition .. www.tcscodevita.com .. (I can just copy paste this comment to atleast 4-5 recent blogs on cf. :\ )
Nice problem :)