Tech Monsters Night Puzzle

Recently M.Video-Eldorado within the hackathon Tech monsters night invited everyone to become participants in the intellectual battle by solving a series of puzzles.

The results of the competition are known, the winners received their well-deserved prizes. Nevertheless, in the comments to the final post, we were asked to share the puzzles used during the competition with the Khabrav residents.

Under the cut is a series of problems offered to Tech Monsters Night participants. So you have a wonderful opportunity to spend this weekend solving these puzzles. There is a suggestion: at the beginning we publish tasks, you post solutions in the comments. And in a couple of days in the updates to this post, we will post the correct answers.

1. Carry out

Condition:

There is a large cargo in the warehouse. The load is in rows, you are given the weight of the load in each row, find such contracts where the sum of the weights of the loads is equal to the number of rows on which they are located. Output the number of such contracts as an answer; this will help to transport the cargo in an optimal way.

Input data: row of weight distribution in a row
Example of input data: “1,2,0” – entered weights of loads in each row.

Contracts:
“2.0”: 2 + 0 = 2 – the number of digits
“1”: 1 = 1 – number of digits
“1,2,0”: 1+ 2 + 0 = 3 – number of digits

Output: number of rows matching the condition

Sample response: 3
Test Pairs😕

2. Multicooker

Condition:

There are k types of multicooker in the store. The quantity of each type of multicooker and their price are given. The buyer needs to buy t multicooker.
It is necessary to sell multicooker to maximize the total cost.

Input data: A string in which pairs of numbers are separated by a semicolon (“;”). The first pair of numbers contains values [t,k], and the subsequent ones – the number of multicooker of each type n, and their cost p. [n,p]… All pairs of numbers are separated by commas (“,”)

Sample input: “7.3; 5.10; 2.5; 3.6”

Three types of multicooker:

  • the first type of 5 pieces, worth 10 each,
  • the second type is 2 pieces worth 5 each,
  • the third type is 3 pieces worth 6 each.

Output: total maximum cost

Sample response: 62
Test Pairs😕

3. Headphones

Condition:

It is necessary to predict whether it is possible, under the conditions described below, to always have from a to b pieces of headphones in stock at the Tune 66 home appliance stores. It is known that exactly t pieces of them are bought every day.

Initially, stores contained h items, while exactly k items are brought to stores at the beginning of each day, starting from the second day. Will the number of headphones stay within the required range for s days?

Input data: A string containing parameters: “h, a, b, s, t, k”. The numbers in the line are separated by commas (“,”)

Answer: “1” if yes, “0” if not
Test Pairs😕

4. Promotion

Condition

An interesting promotion is carried out with the purchase of any phone. The customer can win points on their next purchase. For this, k cans were prepared, each bank contains coins. Each bank has a different number of coins from 1 to k, the number of coins in the bank corresponds to the number of the bank. The buyer chooses two jars, he does not know how many coins are in them.

The buyer receives a half, rounded downward, of the contents of the selected cans and takes it away, along with one of the cans. The rest of the coins are added to the remaining bank and it further participates in the drawing, together with the rest. Find the maximum winnings for all buyers in k-1 steps during the drawing.

Example: let k = 4, then initially there are jars with [1,2,3,4] coins, first we take 4 and 2 jars. The buyer takes away 3 coins, and the remaining 3 coins leaves 2 jars in place. Then it remains [1,3,3]… The next buyer chooses cans 2 and 3, takes half of their contents, that is, 3 coins, and leaves 2 cans in place, the second half, that is, 3 more coins. Then it remains [1,3]… Then the first and second pots are played, the buyer takes 2 coins, and 2 remains, i.e. [2]…

Input data: number k
Answer: How much did all the buyers win in total?
Sample response: eight
Test Pairs😕

5. Event

Condition

It is required to organize t square plots for an advertising event. There are several walls, lengths h1, h2, h3 … hn

Fences for events will be placed near these walls, several sections can be organized against one wall. In this case, the entire wall must be involved in sections. Find such a partition so that the total area of ​​the parcels is minimal.

An example of a partition, here three walls are indicated in green, and 6 sections are indicated in red

Input data: A string separated by a semicolon (“;”) into 2 parts: the first number is the number of sections t, and then a list of the lengths of all walls separated by commas (“,”).

Answer: minimum area
Sample response: fifteen
Test Pairs😕

6. Search for suitable warehouses

Condition:

The store is looking for storage space for household appliances. So that it does not deteriorate, you need to create special conditions. Special plates have been developed, thanks to which household appliances do not deteriorate and storage conditions such as air humidity, temperature, etc. are respected.

A warehouse with a size of 2 by k, is divided into cells with a size of 1 by 1, while some cells are free and it is this space that is intended for storing household appliances. Is it possible to place 2 by 1 plates so that they take up all the free space without overlapping?

An example with plates, where the plates are pink, green, blue.

Input data: a string in which the first number is the storage length k, and the remaining characters are pairs of numbers separated by a semicolon (“;“), which denote the coordinates of occupied points. The coordinates are separated by a comma (”,”).

Sample input: “5; 2.2; 1.4”
Output: “1” if possible, “0” if not.
Test Pairs😕

7. Organization of consultants

Condition:

The store has a system of mutual assistance for consultants. Each consultant, depending on how long he has been working, can help a certain number of his colleagues. Or anyone, if it’s a beginner.

A sequence is drawn up of all employees, which determines how many colleagues he can help. It is necessary from this sequence to determine who will be helped by each employee.

In order not to get confused, each employee can only help colleagues “to the left” of himself or “to the right” of himself in a row. It is necessary to find such a direction for each of them so that all consultants are “closed”. Or write that this is impossible.

If employees are newbies, then they are automatically directed to the right. The input data is chosen so that a single solution can be found. See example below.

Input data: A string containing comma-separated numbers that tell how many of their colleagues the consultant can help. The place of an employee in the sequence cannot be changed.

Sample input: “0,0,2,1,1,2”

Output: A string consisting of 0 and 1, separated by commas, corresponding to the input, in which 0 if the consultant is looking to the left, and 1 if he is looking to the right.

If this is not possible, print the string “NO”.
Sample output in the example: “1,1,0,0,1,0”

Test Pairs😕

8. One team

Condition:

To make the team more united, the administration decided to introduce employees to each other. For this, it was decided to organize trust trainings.

This event involves two teams, and the teams should be divided equally and there should be no familiar people inside each team. There are n departments, people within one department may not know each other. Two departments are selected for the event, and some people from these departments are already familiar with each other. All people from the selected departments participate. Find out how many ways you can divide the participants.

Input data: A string separated by a semicolon (“;”), where the first part is a substring t, n describing the number of employees t and the number of departments n. The second part is a substring that indicates which employee (in order) is in which department (numbers are separated by commas). Subsequent parts – pairs of people who know each other (serial numbers of employees are separated by a comma).

An example of input data: “6,3; 1,1,2,2,3,3; 1.3; 1.5; 1.6; 2.5; 2.6; 3.4; 3.5; 5 , 6 “

Output: number of ways to choose two teams.

Sample response: 2
Test Pairs😕

9. Find a location

Condition:

The question is being resolved where it would be optimal to locate new stores of household appliances. One of the factors is the ways of delivery of household appliances from various warehouses. Each store must be located in one of these vertices, next to some kind of warehouse.

Each type of warehouse is designated by its own number. It is necessary to find the vertices m on which the shops should be placed and which satisfy the conditions:
– when moving from this top to any other, the types of warehouses are not repeated within the same path;
– on different routes, types of warehouses can be repeated;

Count the number of vertices m in the graph.

Graph example [[2,5,1,1,4],[1,2],[1,3],[2,4],[2,5]]while the original peaks are marked in blue

Input data: A string, separated by semicolons (“;”), in which the first part contains the warehouse types in order (separated by commas). The remaining parts are available paths, which are written in two numbers (separated by a comma), where it is shown between which warehouses there is a road.

Sample input: “2,5,1,1,4; 1.2; 1.3; 2.4; 2.5”

Output: number of matching vertices m

Sample response: 3
Test Pairs😕

10. Advertising robotization

Condition:

The store is stocked with goods. An advertising robot should walk around the goods. The store is glazed and shoppers can see the attention-grabbing robot from the outside. To simplify the task, the store floor is presented in the form of a square grid, where goods are located at the grid nodes.

The robot can drive either along the side of the square, the length of which is equal to 1, or diagonally. The robot must go around the entire contents of the store from the outside in order to be seen. Find the length of the shortest path the robot must travel.

An example of the minimum route, when bypassing three points.

Input data: A string containing the coordinates of the items. Each item is separated by a semicolon (“;”), and each coordinate in it is a comma (“,”)
An example of input data: “1.2; 3.4; 4.1”

Sample response: 3
Test Pairs😕

Similar Posts

Leave a Reply Cancel reply