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]
# | User | Rating |
---|---|---|
1 | tourist | 3690 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 173 |
2 | awoo | 164 |
3 | adamant | 163 |
4 | TheScrasse | 160 |
5 | nor | 157 |
6 | maroonrk | 156 |
7 | -is-this-fft- | 152 |
8 | Petr | 146 |
8 | orz | 146 |
10 | pajenegod | 145 |
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]
Name |
---|
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 :)