+ 1

4 stones vs 40 kg..??

shopkeeper has 4 stones total weight of 40 kilograms so he can weight any of kilogram between 1 to 40 by adding and subtracting with four stones only . Find the weight of each weight stone using any language c c++ python any??

4th Apr 2019, 5:14 PM
aman kumar4
aman kumar4 - avatar
8 Antworten
+ 2
How do you subtract or divide stones? 🤔 Are you sure there's a solution to this problem?
4th Apr 2019, 7:17 PM
Anna
Anna - avatar
+ 2
The best solution I found is 27, 9, 3, 1. Allows you to find 34 weights between 1 and 40 kgs
4th Apr 2019, 7:33 PM
Anna
Anna - avatar
+ 1
Anna Anna I think stones are actually blank spaces which can be filled and with operators in between😀
4th Apr 2019, 7:30 PM
Emoji FanBoy
Emoji FanBoy - avatar
+ 1
So, I think you need brute force… You should be able to do that with nested loops at least…
4th Apr 2019, 7:31 PM
Emoji FanBoy
Emoji FanBoy - avatar
+ 1
Yep like ternary search as I had in mind. But what about multiplication and division?
4th Apr 2019, 7:40 PM
Emoji FanBoy
Emoji FanBoy - avatar
+ 1
Sorry for multiplication and division it has only addition and sutraction
7th Apr 2019, 5:10 PM
aman kumar4
aman kumar4 - avatar
+ 1
Dear friends, 1,3,9 and 27 is the right answer I checked all the numbers from 1 to 40 by these 4 no.
9th Apr 2019, 9:14 AM
aman kumar4
aman kumar4 - avatar