searching the immediately largest can fail i think but depends how u handeled
as in case of 11 , immediately larger is 27 but it can be handled using 1,3,9 only as 9+3-1 so what is needed is find min i such that for 0-i sum of 3^i's is greater than X On Wed, Jan 12, 2011 at 11:42 PM, muthu valliappan < muthuvvalliap...@gmail.com> wrote: > https://www.spoj.pl/problems/SCALE/ > hi guys.. need tips on solving this problem > i thought as follows: > > search the immediately largest weight to the given number in the > series of powers of three(log n) > then do bit wise checking to find the set bit (after introducing the > given weight in a proper place in the series till the no found in the > above step) > logic similar to find the subset sum using set bits... > > http://www.codechef.com/wiki/tutorial-paying > > > now if u analyse the sum generated sums.. not more than 2 cases will > have the same sum > one denotes the left pan and the other denotes the right pan > > this worked with test cases i checked... > > help me out.. > thanks guys.. :-) > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.