Solution of logical tasks by reasoning by the method.

Solution of logical tasks by reasoning by the method.

Question: On a trip, five friends - Anton, Boris, Vadim, Dima and Grisha - got acquainted with the fellow traveler. They offered her to guess their names, and each of them expressed one true and one false statement: Dima: "My surname Mishin, and the name Boris - Khokhlov." Anton: "Mishin is my surname, and the last name Vadima - Belkin." Boris: "Vadim - Tikhonov, and my surname is Mishin." Vadim: "I am Belkin, and the name Grisha - Chekhov." Grisha: "Yes, my surname of Chekhov, and Anton - Tikhonov." Who has what surname? Solve the task, making up and converting a logical expression:

On a trip five friends - Anton, Boris, Vadim, Dima and Grisha - got acquainted with the fellow traveler. They offered her to guess their names, and each of them expressed one true and one false statement: Dima: "My surname Mishin, and the name Boris - Khokhlov." Anton: "Mishin is my surname, and the last name Vadima - Belkin." Boris: "Vadim - Tikhonov, and my surname is Mishin." Vadim: "I am Belkin, and the name Grisha - Chekhov." Grisha: "Yes, my surname of Chekhov, and Anton - Tikhonov." Who has what surname? Solve the task, making up and converting a logical expression:

Answers:

Decision. We denote the utteration form "The young man named A is called B" How AB, where the letters a and b correspond to the initial letters of the name and surname. Fix the statements of each of the friends: DM and BC; AM and WB; W and bm; WB and GC; GC and AT. Suppose first that truly dm. But, if truly DM, then Anton and Boris have other names, it means Am and BM false. But if AM and BM are false, then there should be true WB and W, but the WB and WT are simultaneously true to be true. Therefore, another case remains: True bh. This case leads to a chain of conclusions: Bh Truly BM False Tue True AT False GC True WB is false AM True. Answer: Boris - Khokhlov, Vadim - Tikhonov, Grisha - Chekhov, Anton - Mishin, Dima - Belkin.

Similar questions

  • give 3 sample names from sowing sides with diminishing suff
  • computer 2 proposals so that in the first case the involvement turnover stood before the word-defined word, and in the second-after the definitive word. Explain the alignment of punctuation marks in these proposals.
  • Decide please .... Thin spiral spring, for which the law is fair., Suspended vertically on the fixed support, stretches under the action of forces 160n by 72 mm. On the spring, they felt an additionally by force 120n. Direct the extension of the spiral.
  • for a bouquet, white and red roses are chosen for 2: 3 ratio. Find the ratio of the number of white roses to the total number of roses in the bouquet

Question: On a trip, five friends - Anton, Boris, Vadim, Dima and Grisha, got acquainted with his fellow traveler


Dear members of the forum, I ask for help in solving the task on the prologue))

On a trip, five friends - Anton, Boris, Vadim, Dima and Grisha, got acquainted with the fellow traveler. They offered her to guess their names, and each of them expressed one true and one false statement:
Dima said: "My surname is Mishin, and Boris's surname - Khokhlov." Anton said: "Mishin is my surname, and the last name Vadima - Belkin." Boris said: "Surname Vadima - Tikhonov, and my surname - Mishin." Vadim said: "My surname - Belkin, and the name Grisha - Chekhov." Grisha said: "Yes, my surname of Chekhov, and the name of Anton - Tikhonov."
What surname is each of friends?

Thank you so much for the assistance rendered !!!

Answer: Checking online

Question: Program for solving the Olympiad Task of Vasi on the subway on a travel ticket


Boy Vasya goes every day on the subway. In the morning he rides a school, and in the evening of the same day, back from school, home. In order to save a little, it buys an electronic smart card for x trips. When he wants to go to the subway, he applies a map to the turnstile. If a non-zero number of trips remained on the map, then the turnstile skips Vasya and writes off the card one trip. If there are no trips on the map, the turnstile does not miss Vasya, and he (Vasya) is forced to buy a new map on the same card on the same station and go through the turnstile.
Vasya noticed that due to the fact that the Metro was filled in the morning, buy a new card in the morning in time, and he may be late for school. In this regard, he wants to understand: whether there will be such a day that in the morning, walking to school, it turns out that he has a zero trips on him.
Vasya does not go anywhere else on the subway and therefore enters the subway only at the station near the house and at the station near the school.
Input data
The input file input.txt contains exactly 2 lines. The first contains the word "SCHOOL" or "HOME", depending on where the first time Vasya bought a card on x trips. The second line contains the natural number X, 1 ≤ x ≤ 1000.
Output
In the output file Output.txt, you should withdraw "Yes" if there is a day that in the morning, Vasi on the card will be zero travel and "no" otherwise.
Examples
INPUT.TXT OUTPUT.txt
1 Home.
1 Yes
2 School
2 No.

Answer: Very stupid task. The hedgehog is clear that a self-number of trips or odd, it is still with two cards it becomes even. And the whole task is reduced to one primitive condition.

Question: Determine which minimum number of travel on elevator will be required to raise all the equipment


There are weights of 3 domestic appliances in kg (a, b, c). Determine which minimal number of trips on the elevator with a carrying capacity of N kg will be required to raise the entire technique. Help me please.

Answer: INP_W can be easily reduced to the parameter:

Pascal code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Procedure INP_W (Q: String; VAR X: Double); Begin Repeat Write (Q, "\u003d"); Readln (x); If X.<= 0 then WriteLn (q, "There must be more zero, repeat the input.") Until X\u003e 0 END; const M \u003d. "Mass of a household appliance"; G \u003d. "Lift lift"; VAR A, B, C, N: REAL; begin inp_w (m + "" a "", a); INP_W (M + "" B ", b); INP_W (M + "" C "", C); INP_W (G, N); If (A\u003e n) OR (B\u003e N) OR (C\u003e N) THEN WRITE ( "All household appliances cannot be transported by this elevator.") ELSE IF A + B + C<= n then Write ("You will need 1 trip.") ELSE IF (A + B<= n) or (a + c <= n) or (b + c <= n) then Write ("Required 2 trips.") ELSE WRITE ( "Create 3 trips."); Readln end.

Question: Calculation of the cost of a trip by car to the country


2. Make a program for calculating the cost of a trip by car to the cottage (there and back). The source data are: Distance to cottage (in kilometers); The amount of gasoline that consumes a car per 100 km of run; The price of one liter of gasoline. Below is the recommended type of dialogue during the program. The data entered by the user is highlighted in bold.
Calculating the cost of the trip to the country.
Distance to Dacha (km) - 67
Gasoline consumption (l per 100 km) - 8.5
Price of liter gasoline (rub.) - 23.7
A trip to the cottage will cost 269 rubles. 94 kopecks.


How to do it?

Answer: First, with your input data will cost 134 p. 97 k., And secondly

C ++.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 INT MAIN () (Double KM, R, P; Int Itog; Cout<< "Distance to cottage (km) -"; CIN \u003e\u003e KM; Cout.<< "Gasoline consumption (l per 100 km) -"; CIN\u003e R; Cout.<< "The price of liter gasoline (rub.) -"; CIN \u003e\u003e P; Itog \u003d Floor ((KM / 100 * R * P) * 100); Cout.<< "A trip to the cottage will cost in" << itog / 100 << " руб. " << itog % 100 << " коп." ; return 0 ; }

Calculate the cost of gasoline required to travel to the country, if the path is known, the fuel consumption is 100 km and the cost of liter fuel.
Create the form of the form shown in Figure 1.

Picture 1
To calculate the cost of gasoline in the implementation section, write a function Price.
Write a click handler on the calculation button. In the LBLMessage label must be formed a message about the value of gasoline. Be sure to solve using the function!

Answer: The code:

Delphi.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 Unit Mainu; Interface Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Buttons, Stdctrls; Type TForm1 \u003d Class (TForm) Label1: Tlabel; EDWAY: Tedit; Label2: Tlabel; Edfuel: Tedit; Label3: Tlabel; edcost: tedit; BTNRUN: TButton; BitBTN1: TBITBTN; LBLMessage: Tlabel; Procedure BtnrunClick (Sender: Togject); Procedure BitBTN1Click (Sender: Togject); Private (Public Declarations) end; Var Form1: TForm1; Implementation ($ R * .dfm) Function Price (Way, Fuel, Cost: Extended): Extended; Begin Result: \u003d (Way / 100) * Fuel * Cost; end; Procedure TForm1. BTNRUNCLICK (Sender: Togject); VAR EWAY, EFUEL, ECOST: EXTENDED; Begin Try Eway: \u003d StrTofloat (EDWAY. Text); Except ShowMessage ( "" The path in km "must be a number!"); exit; end; If Eway.<= 0 then begin showmessage("" The path in km "should be more than 0!"); exit; end; Try Efuel: \u003d Strtofloat (Edfuel. text); Except ShowMessage ( "" Fuel consumption per 100 km in liters "must be a number!"); exit; end; If Efuel<= 0 then begin showmessage("" Fuel consumption per 100 km in liters "should be more than 0!"); exit; end; Try ECOST: \u003d STRTOFLOAT (edcost. text); Except ShowMessage ( "" Cost of liter of fuel "should be a number!"); exit; end; If Ecost.<= 0 then begin showmessage("" Cost of liter of fuel "should be greater than 0!"); exit; end; lblmessage. Caption: \u003d. "The cost of gasoline necessary for a trip to the country:"+ Floattostr (Price (EWAY, EFUEL, ECOST)); end; Procedure TForm1. BitBTN1Click (Sender: Togject); Begin Close; end; end.

Attach project on Delphi.

This method usually solves simple logical tasks.

Example 6. Vadim, Sergey and Mikhail learn various foreign languages: Chinese, Japanese and Arabic. To the question of which language learns each of them, one replied: "Vadim studies Chinese, Sergey does not study Chinese, and Mikhail does not study Arabic." Subsequently, it turned out that only one statement is responsible for this, and the other two are false. What language learns each of the young people?

Decision. There are three statements:

  1. Vadim studies Chinese;
  2. Sergey does not study Chinese;
  3. Mikhail does not study Arabic.

If the first statement is true, then the second and the second, since young men are studying different languages. This is contrary to the condition of the task, so the first statement is false.

If the second statement is true, then the first and third must be false. It turns out that no one studies Chinese. This is contrary to the condition, so the second statement is also false.

Answer: Sergey studies Chinese, Mikhail - Japanese, Vadim - Arabic.

Example 7. On a trip, five friends - Anton, Boris, Vadim, Dima and Grisha, got acquainted with the fellow traveler. They offered her to guess their names, and each of them expressed one true and one false statement:

Dima said: "My surname is Mishin, and Boris's surname - Khokhlov." Anton said: "Mishin is my surname, and the last name Vadima - Belkin." Boris said: "Surname Vadima - Tikhonov, and my surname - Mishin." Vadim said: "My surname - Belkin, and the name Grisha - Chekhov." Grisha said: "Yes, my surname of Chekhov, and the name of Anton - Tikhonov."

What surname is each of friends?

Decision. We denote the utterative form "The young man named A is named B" as a b, where the letters a and b correspond to the initial letters of the name and surname.

Fix the statements of each of the friends:

  1. D m and b x;
  2. And m and in b;
  3. In T and b m;
  4. In b and g h;
  5. G h and a t

Suppose first that truly d M. But, if truly d m, then Anton and Boris have other names, it means that a m and b falsely. But if a m and m is false, then must be true in b and in t, but in b and in t at the same time true cannot be true.

It means that another case remains: True B. This case leads to a chain of conclusions:

B x Truly b m falsely in T TRUE A T Falstly g h True in B falsely and m True.

Answer: Boris - Khokhlov, Vadim - Tikhonov, Grisha - Chekhov, Anton - Mishin, Dima - Belkin.

Example 8.The Ministers of Foreign Affairs of Russia, the United States and China discussed the projects of the all-disarmament agreements on closed doors, represented by each country. Then answering the question of journalists: "Whose project was accepted?", Ministers gave such answers:

Russia - "Project is not ours, project is not USA";
USA - "Project not Russia, Project of China";
China - "Project is not ours, the project of Russia."

One of them (the most frank) both times told the truth; The second (most secretive) both times spoke to a lie, the third (careful) said the truth once, and the other time is not true.

Determine what countries are frank, secretious and cautious ministers.

Decision. For the convenience of recording, there are diplomat statements:

Russia - "Project is not ours" (1), "Project is not USA" (2);
USA - "Project not Russia" (3), "China Project" (4);
China - "Project is not ours" (5), "Project of Russia" (6).

We find out who from the ministers is the most frank.

If this is the Russian minister, then from justice (1) and (2) it follows that the Chinese project won. But then both statements of the US Minister are also fair, which cannot be under the condition.

If the most outstanding is the US Minister, then we again get that the Chinese project won, it means that both statements of the Russian minister are also correct, which cannot be under the condition.

It turns out that the most frank was the Chinese minister. Indeed, from the fact that (5) and (6) are valid, it remains that the Russian project has won. And then it turns out that of the two statements of the Russian minister the first is false, and the second is true. Both allegations of the US Minister are incorrect.

Answer: The Chinese minister was frankly, more careful - Russian, hidden - Minister of the United States.