Current location - Recipe Complete Network - Dinner recipes - How to judge whether a coin is counterfeit or genuine?
How to judge whether a coin is counterfeit or genuine?
The weight of counterfeit money is different from that of real money.

You can weigh it three times with a balance, find out the counterfeit money, and judge whether the weight of the counterfeit money is heavier or lighter than the real money.

Divide coins into three groups, with four coins in each group, which are respectively represented as:

G 1 = ( 1,2,3,4),G2 = (5,6,7,8),G3 = (9, 10, 1 1, 12)。

Comparing G 1 and G2 in the first weighing, it is either balanced or a group of heavier ones. Let's consider these two situations separately:

If G 1 and G2 are balanced, then the counterfeit money must be in G3, that is, the coins of G 1 and G2 are real. In this way, in the second weighing, we can compare any three real coins (such as 1, 2,3) with three coins in G3:

(1, 2, 3) and (9, 10,1)

The results are compared as follows:

1, coin balance. This shows that the counterfeit money is 12, because it is the only coin in G3 that did not appear in the second weighing. After the third weighing (for example, 1 and 12), you can know whether counterfeit money is heavier or lighter than other coins.

2. The coins are not balanced. This means that the counterfeit money is one of 9, 10, 1 1, and we can also know whether the counterfeit money is light or heavy. If the ratio of (1, 2,3) is (9, 10, 1655), and vice versa. The third weighing (such as 9 and 10) can determine which one is counterfeit. If 9 and 10 are balanced, then counterfeit money is 1 1. If it is unbalanced, then we can know which one is counterfeit according to the known information of whether counterfeit money is lighter or heavier.

If G 1 and G2 are not balanced, then we can know 1. , counterfeit money in G 1 or G2 2. , coins 9. , 10, 1 1 2 are all real coins.

Move a coin in G2 (e.g. 5) to the left of the balance and add a real coin (e.g. 12) to the right of the balance. So the second weighing is (1, 2,5) and (3,4, 12).

Assuming that the coin (1, 2, 3, 4) is heavier than (5, 6, 7, 8) in the first weighing, there are three possible results in the second weighing:

1, coins (1, 2,5) are heavier. This shows that coins 3, 4 and 5 are real, because we have changed their positions in the balance, but the weighing result remains the same (that is, the one on the left is heavier). Since the coin 12 is real, counterfeit money is 1 or 2, counterfeit money.

2. Coins (3, 4, 5) are heavier. Because the weighing results of the two cars have changed (that is, the left side of the balance is heavier for the first time, and now the right side is heavier), the counterfeit money must have moved from one end of the balance to the other. Therefore, either coins 3 and 4 are fake heavier, or coins 5 are fake lighter. Therefore, the third weighing (3 and 4) is carried out again.

3. Coins (1, 2,5) and (3,4, 12) are balanced. This shows that counterfeit money must not be included in the second weighing, but must be one of 6, 7 and 8. At the same time, from the results of the first weighing, counterfeit money is lighter. In this way, the third comparison was made.

Extended data:

The topic of C language-called coins

Description?

Sally has 12 silver coins. Where real money 1 1 and counterfeit money 1. Counterfeit money looks no different from real money, but its weight is different. But Sally doesn't know whether counterfeit money is lighter or heavier than real money. So he borrowed a balance from his friend. My friend hopes that Sally can find out the counterfeit money after three times and determine whether it is light or heavy. For example, Sai weighed two coins with a balance and found that the balance was balanced, which means that both coins are real. If a real coin is lighter or heavier than another silver coin, it means it is counterfeit. After careful arrangement of each weighing, Sally promised to determine the counterfeit money after three weighing.

About input?

The first line is n, which means there are n groups of data. ?

Followed by n*3 lines. Each set of data has three rows, and each row represents the result of one weighing. Sally marked the silver coin A-L in advance. The result of each weighing is represented by three strings separated by spaces: the balance state of silver coins placed on the left and right of the balance. The equilibrium state is represented by "up", "down" or "even", which are high at the right end, low at the right end and balanced respectively. The number of silver coins on the left and right sides of the balance is always equal.

About output?

The output is n lines. Each line outputs a set of data, which label of silver coin is counterfeit, indicating whether it is lighter or heavier than real money. ?

If the k-th silver coin is fake and light, then the output is:?

K is counterfeit money. It's very light. ?

If the k-th silver coin is fake and heavy, then the output is:?

K is counterfeit and heavy.

Sample input?

1

ABCD EFGH even number

ABCI EFJK up

Abijah ·EFGH even

Sample output?

K is counterfeit money. It's very light.