Getting out of the wheel of Samsara, extremism and a little bit of green - an analysis of tasks from the GridGain booklet at the Joker 2018 conference

3r3-31. On October 19 and 2? a Joker conference was held in St. Petersburg - the best event for those who love the same thing as us: cool reports, communication with advanced Java experts and problems. We will not praise the third issue of tasks from GridGain ( 1 , 2 ), Better quote the feedback from participants:

3r33434.

[i] “Their tasks seemed silly and unrelated to IT” 3r33434.

“Excellent tasks, as always (though I haven’t mastered any of them)” 3-3343429

“Drug addiction in tasks” 3r33429.

“Top Tasks, As Always,” 3r317. 3r33434.

3r33434.

We publish, as promised, detailed solutions. They brought it under a spoiler so that those who missed the conference could also try their hand. 3r33434.

3r33434.

3r33434.

3r330. 3r33434.

3r33427. Problem 1

3r33434.

Three months ago, we wrote this task, but in October 201? the President took the initiative to decriminalize 282 articles, which we are very happy about, but we’ve got to redo the texts. So let everything in this problem remain as it was. *

3r33434.

Center-on-a-letter monitors the placement of offensive memes, as well as their likes and reposts in social networks. As part of the digital transformation, the whole office of the employees of the monitoring department was replaced by artificial intelligence. Innovation has helped to quickly calculate the likelihood of users from the likes will go to repost, so that you can successfully bring the case to court. Previously, a conviction at the request of the Center-for-one-letter was delivered with a probability of 90% for 192 days. Process automation brought the performance up to 12 days with a probability of 99.9%. 3r33434.

3r33434. ** Question: ** How many times did the conversion of memases into convictions increase by 28? thanks to an innovative approach, if the frequency of sentences has an exponential distribution? 3r33434.

3r33434.

Solution of the problem 1 [/b]

* Having called the author of the quotation and the work on our stand, one could immediately receive a gift. Of course, this is Yuri Khoy (Klinskikh), “The Gas Sector” and the track “Bum” 3–3–3429.

3r33434.

According to the original condition, since the frequency of sentences has an exponential distribution, then before and after the introduction of the robot, we have the following expressions for estimating the probability that a sentence was pronounced in a time ≤ t:

3r33434.

3r33414. 3r31616. 3r33434.

3r33434.

where

3r399. 3r31616. - these are unknown parameters that set the frequency of sentencing, t is a time parameter, according to the condition that: r3r3429.

3r33434.

3r33414. 3r31616. 3r33434.

3r33434.

From these equations, parameters

are very easily expressed. 3r399. 3r31616. 3r33434.

3r33434.

3r33414. 3r33939. 3r31616. 3r33434.

3r33434.

From the assumption that the number of sentences and the number of memesics are linearly dependent, we can conclude that the ratio is 3r33414. 3r399. 3r31616. just gives the desired value:

3r33434.

3r33414. 3r31616. 3r33434.

3r33434.

3r33434.

3r3116. 3r33434.

3r33434.

3r33427. Problem 2

3r33434.

From the point of view of the Buddhist Basil, the code is perfect not when there is nothing to add to it, but when nothing can be removed. Driven by this idea, our Basil decided to improve EpsilonGC and revealed to the world Dzen-GC - a product of perfect thought, which can not only clear heap memory, but does not even allow it to be allocated. It is obvious that allocation in JVM with this innovative GC is possible only on the stack and only for primitive types. 3r33434.

3r33434.

To test the new functional, Vasily decided to write a Java function that finds a mode for 6 values (a mode is a value in the set of observations that occurs most often), that is, it has the following signature: 3r342929.

3r33434.

3r3202. ` public static int mode (int n? int n? int n? int n? int n? int n5) `

3r33434.

To get closer to enlightenment, Vasily did not declare additional local variables and methods in his code, and also programmed only the little finger of his left foot. 3r33434.

3r33434. ** Task: ** help Vasily in the implementation of this function (it is allowed to use all fingers). 3r33434.

3r33434.

Solution of the problem 2 [/b]

Let's try to figure out how this problem could be solved if there were no such strict restrictions. We simply say that the values are transferred in an array, and it is advisable not to use additional memory (but a little bit is possible). 3r33434.

3r33434.

Then we'll check out the options using Map

, and note that it is most convenient to look for fashion in a sorted array: if the value is repeated, all duplicates are nearby. We will sort the array and in one pass (and two variables) we will find the value with the maximum number of repetitions. 3r33434.

3r33434.

Now note that:

3r33434.

1) You can sort the values recursively. 3r33434.

3r33434.

3r3202.

//Expectation: if there are any.

//?????4 has 3 modes: ??4. I expect that 3 is the correct answer.

public static int mode (int a, int b, int c, int d, int e, int f) {

//If arguments are not sorted, let's sort it with bubble sort

if (a> b)

return mode (b, a, c, d, e, f);

if (b> c)

return mode (a, c, b, d, e, f);

if (c> d)

return mode (a, b, d, c, e, f);

if (d> e)

return mode (a, b, c, e, d, f);

if (e> f)

return mode (a, b, c, d, f, e);

3r33434.

3r33434.

2) We have a total of 6 sorted values. 3r33434.

3) If the value is repeated 3 times (half of all values) - this is already a fashion! 3r33434.

3.1) If not, but there are 2 repetitions - then it is a fashion! 3r33434.

3.2) If there are no duplicate values, then any value is a fashion. 3r33434.

3r33434.

3r3202.

//Check for mode with 3+ repeats. 3 repeats is a mode (3 is half of 6).

//Since args are sorted, a == b && b == c is the same as a == c;

if (a == c)

return a;

if (b == d)

return b;

if (c == e)

return c;

if (d == f)

return d;

//Check for 2 repeats.

if (a == b)

return a;

if (b == c)

return b;

if (c == d)

return c;

if (d == e)

return d;

if (e == f)

return e;

return f;

}

3r33434.

3r33434.

Strictly speaking, a task can have many solutions, but we liked it as the simplest and harmonious one. 3r33434.

3r33434.

3r33434.

3r33434.

3r33427. Problem 3

3r33434.

Two drug addicts decided to get out of the Matrix and figure out which one was the Chosen One. To do this, they extracted 1 pack of blue and 4 packs of red tablets (packs of the same size), and in order to enhance the effect, they decided to wash them down with green paint. 3r33434.

3r33434.

Suddenly, it turned out that because of the glitch of the Matrix (as addicts thought), their faces, which originally had RGB colors # 2D241D and # F4E3E? began to change depending on the number of pills and green stuff consumed: each tablet (or 1 ml of green stuff) linearly increases the number of colors on the face of the addict. 3r33434.

3r33434.

At the same time, the value of each RGB component cannot exceed #FF, that is, the further use of pills or brilliant green has no effect. Zelenka initially had several full bubbles of 20 ml each, a total of 2 times less quantity per ml than the total number of tablets in pieces. After the event of leaving the Matrix, in which the second drug addict ate 3r-33429.

54 red pills more than the first blue, addicts have nothing left. 3r33434.

3r33434. ** Question: ** how many pills and brilliant green each addict consumed, if in the end their faces were # F0FF6B and #FFFEFF respectively, and it is known that the brilliant green acts 3 times stronger than the red tablets, which, in turn, 2 times 3r33434.

weaker than blue? 3r33434.

3r33434.

Solution of the problem 3 [/b]

To begin with, we will select among the final values for colors only those that are strictly less than 0xFF, because, by the condition, for the value 0xFF we can only give the lower limit of the used color amplifier. These are the values 0xF? 0x6B and 0xFE. We get the following equations:

3r33434.

3r33414. 3r31616. 3r33434.

3r33434.

or

3r33434.

3r33414. 3r31616. 3r33434.

3r33434.

Here k is the coefficient of action of the red tablets,

3r33232. 3r31616. , Is the number of used amplifiers (we measure tablets in pieces, brilliant green in milliliters) of the corresponding color by the corresponding consumer. Further, we know that the second ate up 54 more red pills than the first one blue, everything is simple: 3r33429.

3r33434.

3r33414. 3r3306. 3r31616. 3r33434.

3r33434.

Another equation is obtained from the condition on the ratio between the number of tablets and milliliters of greens:

3r33434.

3r33414. 3r33333. 3r31616. 3r33434.

3r33434.

Also we have from the ratio between red and blue pills:

3r33434.

3r33414. 3r31616. 3r33434.

3r33434.

In addition, we know that the brilliant greens were some 20 ml each time:

3r33434.

3r33414. 3r31616. where z is non-negative integer. 3r33434.

3r33434.

From the assumption that k is whole and the pills are eaten whole (Zelenka can be drunk as you please), the only answer that suits the following is

3r33434.

3r33414. 3r33350. 3r31616. 3r33434.

3r33434.

3r33414. 3r33357. 3r31616. 3r33434.

3r33434.

It can be obtained quite simply, for example, in the manner described below. 3r33434.

We have the relation

3r33333. 3r31616. . The only expansions of 39 into two factors are {? 39}, {? 13}. Thus, k can take values only from the set {? ? 1? 39}. Let's try the value "3". 3r33434.

3r33434.

3r33414. 3r33333. 3r31616. 3r33434.

3r33434.

But at the same time

3r33380. 3r31616. must be a multiple of 20 that does not hold for the value (79.5 + 3). 3r33434.

3r33434.

The values “13” and “39” are eliminated in exactly the same way. The only value that remains for k is one. Substituting it, we do not come to contradictions and get an answer. 3r33434.

3r33434.

In fact, since nowhere in the problem it is not said that the linear increment coefficient k of the red RGB component is an integer, the solutions result in a whole family, * even * if we assume that green stuff is drunk only in multiples of 1 ml, and the tablets are consumed as a whole (which also not specified separately):

3r33434.

3r33414. 3r33395. 3r31616. 3r33434.

3r33434.

3r33414. 3r3402. 3r31616. 3r33434.

n is a nonnegative integer. 3r33434.

3r33434.

To obtain this family, you need to get rid of k in the first 3 equations, rewriting them, for example, as: 3r3343429.

3r33434.

3r33414. 3r3155. 3r31616. 3r33434.

3r33434.

after that, solve the system of linear Diophantine equations (of course, by including in it the other equations reduced to the proper form). If we do not assume that brilliant green is consumed only by volumes that are multiples of a milliliter, we already get a nonlinear system of Diophantine equations, taking the numerator and denominator g1 and g2 as whole unknowns (which, obviously, should be rational). If we solve the problem in the most general form (all values are continuous), then there are even more solutions. 3r33434.

3r33434.

3r33427. Winners

3r33434.

True, all problems were solved by Alexey Ryzhikov and Valentin Shipilov. Also Alexey Galkin, Anton Blinov, Ilya Perevozchikov and several other participants received prizes. Congratulations!

3r3r434. ! function (e) {function t (t, n) {if (! (n in e)) {for (var r, a = e.document, i = a.scripts, o = i.length; o-- ;) if (-1! == i[o].src.indexOf (t)) {r = i[o]; break} if (! r) {r = a.createElement ("script"), r.type = "text /jаvascript", r.async =! ? r.defer =! ? r.src = t, r.charset = "UTF-8"; var d = function () {var e = a.getElementsByTagName ("script")[0]; e.parentNode.insertBefore (r, e)}; "[object Opera]" == e.opera? a.addEventListener? a.addEventListener ("DOMContentLoaded", d! 1): e.attachEvent ("onload", d): d ()}}} t ("//mediator.mail.ru/script/2820404/", "_mediator")} (window); 3r33434.

It may be interesting

#### weber

Author**4-11-2018, 03:29**

Publication Date
#### Development / Mathematics

Category- Comments: 0
- Views: 235

Pleasant data, significant and magnificent plan, as offer great stuff with smart thoughts and ideas, bunches of incredible data and motivation, the two of which I need, on account of offer such an accommodating data here.

Cheers!