Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

The Machine Game

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone who wanna try this?
Quite and old and comon game...

I got 10 machines dishing out coins of 10 grams each.... One machine becomes faulty and dishes out an 11 gram coin.
With just one try on an electronic display weighing scale, how do i determine the faulty one?
 
Ranch Hand
Posts: 628
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
set the machine such that the 1 st machine dishes out 1 coin..2nd machine 2 cone....10th machine 10 coin...

Now summation of all coins =10(1+2...10)= 10*10*11/2=550---1

Now weigh all the coins...you will get X----2

Now subtract 1 from 2 and then divide by 10 you will get the answer...
 
Bartender
Posts: 1205
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pratik Lohia:
Anyone who wanna try this?
Quite and old and comon game...

I got 10 machines dishing out coins of 10 grams each.... One machine becomes faulty and dishes out an 11 gram coin.
With just one try on an electronic display weighing scale, how do i determine the faulty one?



This type of problem has been popping up in the Programming Diversions forum even though it doesn't really have much to do with programming.

Anyhow...

Grab...
1 coin from machine 1 plus
8 coins from machine 2 plus
7 coins from machine 3 plus
4 coins from machine 4 plus
5 coins from machine 5 plus
6 coins from machine 6 plus
3 coins from machine 7 plus
2 coins from machine 8 plus
9 coins from machine 9 plus
10 coins from machine 10

Weigh them all together. Cube that result. The last digit of that result shows the malfunctioning machine (last digit==0 -> machine 10).
 
Willie Smits can speak 40 languages. This tiny ad can speak only one:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic