📜 ⬆️ ⬇️

Competition for programmers №3

There is an environment and many factors affecting the state of the environment . Each factor of the set of factors may either be present in this set or be absent. The total number of different factors is 32

The state of the environment is determined by an array of thirty-two characteristics of the environment . Each characteristic of the environment is an integer in the interval [0..255]

Each factor of multiple factors present contributes to each characteristic of the state of the environment , increasing the value of each characteristic by an integer in the interval [0..255]
')
The contributions of all factors are summarized for each environmental characteristic . The empty set of factors corresponds to the state of the environment with zero values ​​of all characteristics.

There are input matches: a variety of factors 1 -> state of the environment 1. Using input matches, it is necessary to determine as many correct matches as possible for a given set of factors 2.

The input file set1.dat contains four byte values ​​for the factor sets. Each unit bit corresponds to the present factor with the corresponding sequence number in the set, zero to the missing one.

Examples:
1000 ... factor # 0 is present
1011 ... there are factors №0,2,3
etc.

Input states1.dat file
contains 32 byte records of the environment states corresponding to the input combinations of factors, in the order corresponding to the sets from set1.dat

The input file set2.dat contains four-byte values ​​of the sets of factors, the correspondences of the states of the environment that need to be found and written to the output file in the format of 32-byte records

Good luck !!!

All the necessary files in the zip archive can be downloaded here .
MD5 archive checksum (konkurs3_task.zip) = 341c9f4c381575b7e70584de86e8c9b0

The procedure and rules of the competition can be found here.

UPD: Competition is over. Results and discussion here

Source: https://habr.com/ru/post/118987/


All Articles