# When there is nothing more to drink

In the past few years, I regularly find myself in this situation: I still have to go to the destination hour, ten hours or a day, for some reason the statement from the article’s title has been made, the window looks like in the photo below, and everything that could be talked about, already talked. In these cases, my university education comes in handy for me, and I recall the tasks that we once solved during breaks, and the games that we played at lectures. In this habrastati I will give a few tasks and games that will allow you to spend time on the train much more fun. The most difficult thing in this situation is that you need to remember problems that would be understandable and interesting to everyone, so some cool math problems disappear. With games it’s even more difficult, they, firstly, should also be interesting to everyone, and secondly, in such cool games,

Since there is yet another summer month ahead, then for sure this habrapost will be useful to someone.

1. How to write the number 100 using three deuces and any signs of mathematical operations?

2. Take a chessboard and saw off cells A1 and H8 from it. Is it possible to bridge the remaining field with “dominoes” of size 1 cell per 2 cells?

3. Divide the circle into six sectors, write the numbers 1, 0, 1, 0, 0, 0 in the sectors. It is allowed to add one to two adjacent numbers. Is it possible to make all numbers the same?

4. Cucumber is 90 percent water, and people - 70 percent. How many percent is a cucumber?

5. Three turtles crawl. The first one says: "There is nobody in front of me, and behind me there are two turtles." The second says: "There is one turtle ahead of me and one turtle behind me." And the third says: "There is one turtle ahead of me, one turtle behind me." How can this be?

6. How to cut a cake into 8 identical parts with three cuts?

7. The plane flew 100 kilometers to the south, then 100 kilometers to the east, and then 100 kilometers to the north. As a result, the plane was at the starting point. Where could he fly out of?

8. A staircase is leaning against the wall. On the middle rung of this ladder sits a fearless kitten. The staircase begins to “move” so that one end touches the wall and the other floor. As a result, the staircase is on the floor. What path did the kitten move on?

9. There are five identical boxes, as well as a spoon, a match, an apple, a banana and a key. All items were distributed in boxes and asked 100 people to guess where what is. It turned out that 50 people did not correctly guess a single object, 10 people correctly guessed one object, another 10 people correctly guessed two objects, and 15 people correctly guessed three objects. How many people correctly guessed four objects, and how many people correctly guessed all five objects?

10, 11, ... More problems can be found in the recent habrastaty "10 entertaining tasks . "

If your company has programmers, then you can do programming on a piece of paper.

1. Write a program that prints numbers from 1 to 10,000 without using any comparisons.

2. In the int array, all numbers except one are repeated twice. How to find this lone number in O (1) memory and O (

3. In the array of ints there is a number that occurs more than half the time. How to find this number in O (1) memory and in one pass through the array?

4. Think of a situation where the following code prints NO:

5, 6, ... Each programmer can find more programming puzzles in his head and share particularly interesting in the comments.

1. If you have a piece of paper and two pens, then you can play the good old

2. If you have a piece of paper in the box, and are tired of playing sea battle, then you can play

Unlike many games on paper, there is more action. I note that it is more interesting to play with pens of different colors and after each goal to change a piece of paper.

3.

It is better to play on a sheet without cells, but if there is only a sheet in a cell, then you need to bend it not in a line. It turns out that it is not so easy to get on the tank from the first try, I usually am 2-5 millimeters wrong.

If there are no pens or paper, then you can play

How many times have not played this game, always goes with a bang. If everyone knows the garages, you can play “we’re going camping with you”, or some similar game, there are a lot of such games.

That's all, if you still know some other way to have fun and usefully spend time on the train, then tell us in the comments.

Yes, so as not to get up twice, does any of the hawkers know how to explain with the help of fingers, apples, money, etc., why, when multiplying two negative numbers, it turns out positive? (I know how to deduce real numbers from the axiomatics, but I don’t know any obvious explanation.)

Since there is yet another summer month ahead, then for sure this habrapost will be useful to someone.

##### Mathematical and "mathematical" problems

1. How to write the number 100 using three deuces and any signs of mathematical operations?

**Answer**

100 = −log

_{2}log_{2}sqrt (sqrt (... sqrt (2) ...)), where instead of ... you need to write the square root sign 97 more times.2. Take a chessboard and saw off cells A1 and H8 from it. Is it possible to bridge the remaining field with “dominoes” of size 1 cell per 2 cells?

**Answer**

It’s impossible, it’s not difficult to come up with a suitable invariant.

3. Divide the circle into six sectors, write the numbers 1, 0, 1, 0, 0, 0 in the sectors. It is allowed to add one to two adjacent numbers. Is it possible to make all numbers the same?

**Answer**

It’s impossible, it’s not difficult to come up with a suitable invariant.

4. Cucumber is 90 percent water, and people - 70 percent. How many percent is a cucumber?

**A comment**

I don’t know how to solve this problem :) It seems to me that the condition is incorrect, well, let the main thing is to have fun!

5. Three turtles crawl. The first one says: "There is nobody in front of me, and behind me there are two turtles." The second says: "There is one turtle ahead of me and one turtle behind me." And the third says: "There is one turtle ahead of me, one turtle behind me." How can this be?

**Answer**

One of the turtles is lying. The reaction of people at the moment when they are given the correct answer is unpredictable.

6. How to cut a cake into 8 identical parts with three cuts?

**A comment**

There are at least two solutions.

7. The plane flew 100 kilometers to the south, then 100 kilometers to the east, and then 100 kilometers to the north. As a result, the plane was at the starting point. Where could he fly out of?

**A comment**

You can even fly around the pole several times.

8. A staircase is leaning against the wall. On the middle rung of this ladder sits a fearless kitten. The staircase begins to “move” so that one end touches the wall and the other floor. As a result, the staircase is on the floor. What path did the kitten move on?

**A comment**

That the answer is a piece of a circle, everyone guesses, but not everyone correctly guesses in which direction this piece will be convex.

9. There are five identical boxes, as well as a spoon, a match, an apple, a banana and a key. All items were distributed in boxes and asked 100 people to guess where what is. It turned out that 50 people did not correctly guess a single object, 10 people correctly guessed one object, another 10 people correctly guessed two objects, and 15 people correctly guessed three objects. How many people correctly guessed four objects, and how many people correctly guessed all five objects?

**A comment**

There is actually enough data.

10, 11, ... More problems can be found in the recent habrastaty "10 entertaining tasks . "

##### Programming tasks

If your company has programmers, then you can do programming on a piece of paper.

1. Write a program that prints numbers from 1 to 10,000 without using any comparisons.

**A comment**

A program whose body consists of 10,000 printfs is not an elegant solution.

2. In the int array, all numbers except one are repeated twice. How to find this lone number in O (1) memory and O (

*n*) operations?**A comment**

Do not forget about XOR.

3. In the array of ints there is a number that occurs more than half the time. How to find this number in O (1) memory and in one pass through the array?

**Answer**

On a habr there was an article "Search of often meeting elements in an array" about this task. This task seems to me difficult, but most of the people to whom I asked this task solved it.

4. Think of a situation where the following code prints NO:

```
if (v == v) {
std::cout << "YES";
} else {
std::cout << "NO";
}
```

**Answer**

For example, v = NaN.

5, 6, ... Each programmer can find more programming puzzles in his head and share particularly interesting in the comments.

##### Games on a piece of paper

1. If you have a piece of paper and two pens, then you can play the good old

*naval battle*. This is one of those games that never get boring.2. If you have a piece of paper in the box, and are tired of playing sea battle, then you can play

*football*. The rules are simple: in the middle of the short sides of the leaf, we draw a gate with a size of four cells. In the center of the sheet at the intersection of lines, draw a ball. The task of the players is to score the ball into the opponent’s goal. Players take turns, one move - three squares, the path can be bent at the grid nodes, lines can only be drawn in a straight line and diagonally, but lines already drawn cannot be crossed. If one of the players can’t walk, then the opponent hits a “penalty”, that is, he draws a segment of 8 cells in length. This line can also go in a straight line or diagonally, it cannot be bent.Unlike many games on paper, there is more action. I note that it is more interesting to play with pens of different colors and after each goal to change a piece of paper.

3.

*Tanchiki*- This is another game for two people on paper. The rules are as follows: the sheet is bent in the middle, then unbent. Each of the players in his half draws five tanks the size of five by five millimeters. After that you can play: the first player draws a point in his half and bends the sheet. If the point after bending turned out to be inside the enemy’s tank, then the tank is considered dead and the player can proceed to destroy another tank, if the point falls on the border of the tank, then the tank is considered wounded, otherwise it is believed that the player missed and the move is transferred to the next player. Whoever first destroyed all the enemy tanks, he won.It is better to play on a sheet without cells, but if there is only a sheet in a cell, then you need to bend it not in a line. It turns out that it is not so easy to get on the tank from the first try, I usually am 2-5 millimeters wrong.

##### Garages-like games

If there are no pens or paper, then you can play

*garages*and similar games. Here the main condition is that not everyone knows what kind of game it is. For garages, the rules are as follows: a few small items are taken, anything is suitable: a spoon, a lighter, an apple, a glass, etc. Then the host, who knows the essence of the game, puts some configuration of these items on the table and says: “These are three ", Then moves one or more objects and says:" And these are five. " This is repeated a couple more times, then some other combination develops, and the moderator asks: “How much is this?” Everyone else should understand the rule by which a number is determined from the configuration of objects. If you haven’t guessed everything yet, then again examples of configurations are given and numbers are called. So it can last 10-15 minutes. The game is very interesting in that there is no rule, and the called number is the number of fingers,How many times have not played this game, always goes with a bang. If everyone knows the garages, you can play “we’re going camping with you”, or some similar game, there are a lot of such games.

That's all, if you still know some other way to have fun and usefully spend time on the train, then tell us in the comments.

Yes, so as not to get up twice, does any of the hawkers know how to explain with the help of fingers, apples, money, etc., why, when multiplying two negative numbers, it turns out positive? (I know how to deduce real numbers from the axiomatics, but I don’t know any obvious explanation.)