```
You have 5 jars of pills. Each pill weighs 10 grams, except for contaminated pills contained in one jar, where each pill weighs 9 grams. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?
```

# | User | Rating |
---|---|---|

1 | tourist | 3803 |

2 | jiangly | 3707 |

3 | Benq | 3627 |

4 | ecnerwala | 3584 |

5 | orzdevinwang | 3573 |

6 | Geothermal | 3569 |

6 | cnnfls_csy | 3569 |

8 | Radewoosh | 3542 |

9 | jqdai0815 | 3532 |

10 | gyh20 | 3447 |

# | User | Contrib. |
---|---|---|

1 | awoo | 162 |

2 | maomao90 | 160 |

3 | adamant | 157 |

4 | maroonrk | 154 |

5 | -is-this-fft- | 150 |

6 | Petr | 148 |

6 | SecondThread | 148 |

8 | atcoder_official | 147 |

9 | TheScrasse | 145 |

9 | nor | 145 |

```
You have 5 jars of pills. Each pill weighs 10 grams, except for contaminated pills contained in one jar, where each pill weighs 9 grams. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?
```

↑

↓

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/15/2024 14:19:17 (k3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

I will put all the 5 jars on top of the measurement scale and the scale would definitely read as 49 Grams(1 contaminated pill=9 gram + 4 real pill = 4*10). Then, I will remove one jars at a time from the scale, if the pill is real the measured value would reduce by 10 and if the measured value reduced by 9, then we will get that this is the contaminated jar that we r looking for. In the worst case, we would need to remove one jar from the scale 4 times.

You can weight the pills only one time , like if u put some pills from every jar thats it then u cant remove and see

Spoiler Alert!

Spoiler