当前位置:网站首页>There are 12 balls, including 11 weight, only one, don't know is light or heavy. Three times in balance scales, find out the ball.
There are 12 balls, including 11 weight, only one, don't know is light or heavy. Three times in balance scales, find out the ball.
2022-08-04 10:03:00 【Kangkang's Road to Code Farmers】
Solution 1:
Weigh the ping pong ball with an unsecured balance. How many results will there be for each weighing? There are three different results, that is, the weight on the left is heavier, lighter or equal to the weight on the right.To find this unqualified table tennis ball, the balls must be divided into three groups (each of four balls).Now, for the convenience of understanding the problem, we number these three groups of table tennis balls as group A, group B, and group C respectively.
First, choose any two groups of balls and place them on the balance.For example, we weigh the two groups A and B on the balance.There will be two situations:
In the first situation, the balance is balanced on both sides.Then, the unqualified bad ball must be in the c group.
Secondly, randomly take out two balls (eg C1, C2) from group c and place them on the left and right discs respectively, called the second time.At this time, there may be two situations:
1. Balance on both sides of the balance.In this way, the bad ball must be in C3 and C4.This is because, out of 12 ping pong balls, only one is an unqualified bad ball.Only when one of C1 and C2 is a bad ball, the two sides of the scale are not balanced.Since both sides of the scale are balanced, it can be seen that C1 and C2 are both qualified strikes.
When weighing for the third time, you can take out a ball (eg C3) from C3 and C4, and place it on both sides of the balance with another qualified ball (eg C1), then the result can be deduced.At this time, there may be two results: if the balance is balanced on both sides, then the bad ball must be C4; if the balance is not balanced on both sides, then the bad ball must be C3.
2. The two sides of the balance are not balanced.In this way, the bad ball must be in C1 and C2.This is because, only when one of C1 and C2 is a bad ball, the two sides of the scale cannot be balanced.This is called the second time.
When weighing for the third time, you can take out a ball (such as C1) from C1 and C2, and place it on both sides of the balance with another qualified ball (such as C3), and the result can be deduced.The reason is the same as above.
The above is the analysis of the first situation after the first weighing.
In the second case, the balance is not balanced after the first weighing.This shows that Group C must be qualified strikes, and the unqualified bad balls must be in Group A or Group B.
We assume: Group A (with four balls A1, A2, A3, A4) is heavy, and Group B (with four balls B1, B2, B3, B4) is light.At this time, you need to take out A1 in the heavy disk and put it aside, take out A2 and A3 in the light disk, and keep A4 in the heavy disk.At the same time, take out B1 and B4 in the light plate and put them aside, take out B2 and put them in the heavy plate, B3 remains in the light plate, and take another standard ball C1 and put it in the heavy plate.After such an exchange, there are three balls in each set: A4, B2, C1 in the original heavy set, and A2, A3, B3 in the original light set.
At this time, it can be called the second time.There are three possible situations after this weighing:
1. Balance on both sides of the balance.This shows that A4B2C1=A2A3B3, which means that these six are only good balls, so the bad ball must be in A1 or B1 or B4 outside the plate.It is known that drive A is heavier than drive B.Therefore, A1 is either a strike or heavier than a strike; while B1 and B4 are a strike or a lighter than strike.
At this time, you can put B1 and B4 on one end of the balance and weigh the third time.At this time, three situations may also occur: (1) If the balance is balanced on both sides, it can be inferred that A1 is an unqualified bad ball. This is because there is only one bad ball out of 12 balls. Since B1 and B4 have the same weight, it can be seen that these twoThe ball is a strike, and A1 is a strike; (2) B1 is lighter than B4, then B1 is a strike; (3) B4 is lighter than B1, then B4 is a strike, because B1 and B4 are strikes,Or lighter than strikes, so the third call is actually a lighter ball than which of the two lighter balls, and the lighter ball must be the bad ball.
2. The plate with A4, B2, C1 (original group A) is heavier than the plate with A2, A3, B3 (original group B).In this case, the bad ball must be in the unexchanged A4 or B3.This is because the exchanged balls B2, A2 and A3 do not affect the weight, so it can be seen that these three balls are good balls.
The above shows that one of A4 or B3 is a bad ball.At this time, it is only necessary to compare A4 or B3 with the standard ball C1.For example, take A4 and put it on one end of the balance, and take C1 and put it on the other end of the balance.This is the third time.If the scales are balanced, then B3 is the bad ball; if the scales are not, then A4 is the bad ball (in this case A4 is heavier than C1).
3. The plate on which A4, B2 and C1 are placed (group A was originally placed) is lighter than the plate placed on A2, A3 and B3 (group B was originally placed).In this case, the bad ball must be among the balls A2, A3, and B23 just exchanged.This is because if A2, A3, and B2 are all good balls, then the bad ball must be in A4 or B3. If A4 or B3 is a bad ball, then the plate on which A4, B2, and C1 are placed must be heavier than that on A2 and A3., B3 plate, the current situation is just the opposite, so it is not that A2, A3, B2 are all good shots.
The above description shows that one of A2, A3 and B2 is a bad ball.At this time, it is only necessary to compare A2 with A3 and call it the third time, that is, which one is the bad ball.Put A2 and A3 on one end of the balance and weigh it for the third time. There are three possible situations: (1) the two sides of the balance are balanced, which can infer that B2 is a bad ball; (2) A2 is heavier than A3, and it can be inferred that A2 is bad(3) A3 is heavier than A2, so it can be inferred that A3 is a bad ball.
Solution 2
*** Divide the balls into three groups of ABC, each group of four, weigh A and B once if they are the same, then there is a bad ball in C, and three balls (C1C2C3) and three normal balls are taken out of CIn the second weighing, if it is balanced, the bad ball is C4, if it is not balanced, the bad ball is in (C1C2C3), then it can be concluded that the bad ball is heavy or light, then take two of the three balls in C at will.If you look at the balance, you can get a bad ball.
If it is tilted for the first time, combine A1B2B3B4 into a group, B1 and other three normal balls are combined, and weigh again, 1. If the situation remains unchanged, there is a bad ball between A1 and B1, and the thirdJust compare any one of A1B1 with a normal ball.2. If the situation is opposite to the first weighing, there are bad balls in B2B3B4, which can be obtained by following the above method.3. In balance, there are bad balls in A2A3A4, and the above method can be used.
边栏推荐
- Win10电脑经常发出叮咚声音怎么关闭
- 关于ARM2440中断源个数的一点想法[通俗易懂]
- 广东对小鹏/广汽丰田开展网络安全检查
- 使用ClickHouse分析COS的清单和访问日志
- 浅聊偏函数
- Interview at 14:00 in the afternoon, I came out at 14:08 with my head down, asking too much...
- MindSpore:【mindinsight】【Profiler】用execution_time推导出来的训练耗时远小于真实的耗时
- LeetCode 6. Z 字形变换 找规律
- rk3399-339 usb设备复合 总体流程
- 请问下Flink SQL如何写hologres分区表?我想要每天一个分区
猜你喜欢
随机推荐
HCIP 交换实验
Layer 3 Switch/Router OSPF Configuration Details [Huawei eNSP Experiment]
rk3399-339 usb设备复合 总体流程
Anton Paar Anton Paar Density Meter Hydrometer Repair DMA35 Performance Parameters
Detailed explanation of MSTP protocol configuration on Layer 3 switches [Huawei eNSP experiment]
【C补充】指针相关知识点收集01
JDBC知识点
关于DSP驱动外挂flash
LeetCode 54. 螺旋矩阵 蛇形矩阵式输出字符串
leetcode动态规划经典例题——53.最大子数组和
MySQL核心SQL:结构化查询语句SQL、库操作、表操作、CRUD
【C补充】指向指针或函数的指针
Win11如何隐藏输入法悬浮窗?
MindSpore:损失函数问题
数据万象内容审核 — 共建安全互联网,专项开展“清朗”直播整治行动
视频加密怎么播放_win播放器加密视频
Could you please talk about how the website is accessed?[Interview questions in the web field]
用匿名函数定义函数_c语言最先执行的函数是
Redis 内存满了怎么办?这样置才正确!
sqlilabs less-38~39









