Hướng dẫn giải của Enormous Exponentiations


Chỉ dùng lời giải này khi không có ý tưởng, và đừng copy-paste code từ lời giải này. Hãy tôn trọng người ra đề và người viết lời giải.
Nộp một lời giải chính thức trước khi tự giải là một hành động có thể bị ban.

Tác giả: PanyoPie

Subtask #1:

$$x = y \text{ and } u \le v$$

The inequality can be rewritten as:

$$\left\lfloor \dfrac{x^u}{y^v} \right\rfloor = \left\lfloor \dfrac{x^u}{x^v} \right\rfloor = \left\lfloor x^{u - v} \right\rfloor$$

The result should be:

$$a + b = (2 \times \left\lfloor x^{u - v} \right\rfloor) + 1$$

Advanced assessment: The additional constraint for ~u~ and ~v~ is ~u \le v~. Therefore:

$$u - v \le 0 \Rightarrow 0 < x^{u - v} \le 1$$

Check if ~u = v~, then ~x = y \text{ and } u = v \Rightarrow \left\lfloor \dfrac{x^u}{y^v} \right\rfloor = \left\lfloor \dfrac{x^u}{x^u} \right\rfloor = 1 \Rightarrow a \le \left\lfloor \dfrac{x^u}{y^v} \right\rfloor < b \Rightarrow a \le 1 < b \Rightarrow a + b = 2 \times 1 + 1 = 3~.

Otherwise, ~u \ne v~, then ~0 < \dfrac{x^u}{y^v} < 1 \Rightarrow (a = 0) \le \left\lfloor \dfrac{x^u}{y^v} \right\rfloor < (b = 1) \Rightarrow a + b = 2 \times 0 + 1 = 1~.

Subtask #2:

$$u = v \text{ and } x \le y$$

The inequality can be rewritten as:

$$\left\lfloor \dfrac{x^u}{y^v} \right\rfloor = \left\lfloor \dfrac{x^u}{y^u} \right\rfloor = \left\lfloor \left( \dfrac{x}{y} \right)^u \right\rfloor$$

The result should be:

$$a + b = \left(2 \times \left\lfloor \left( \dfrac{x}{y} \right)^u \right\rfloor \right) + 1$$

Advanced assessment: The additional constraint for ~x~ and ~y~ is ~x \le y~. Therefore:

$$x \le y \Rightarrow \dfrac{x}{y} \le 1 \Rightarrow 0 < \left( \dfrac{x}{y} \right)^u \le 1$$

Check if ~x = y~, then ~x = y \text{ and } u = v \Rightarrow \left\lfloor \dfrac{x^u}{y^v} \right\rfloor = \left\lfloor \dfrac{x^u}{x^u} \right\rfloor = 1 \Rightarrow a \le \left\lfloor \dfrac{x^u}{y^v} \right\rfloor < b \Rightarrow a \le 1 < b \Rightarrow a + b = 2 \times 1 + 1 = 3~.

Otherwise, ~x \le y~, then ~0 < \left( \dfrac{x}{y} \right)^u < 1 \Rightarrow (a = 0) \le \left( \dfrac{x}{y} \right)^u < (b = 1) \Rightarrow a + b = 2 \times 0 + 1 = 1~.

Subtask #3: No additional constraints

$$ \dfrac{x^u}{y^v} = 10^{\log_{10}{\frac{x^u}{y^v}}} $$ $$ \log_{10}{\dfrac{x^u}{y^v}} = \log{x^u} - \log{y^v} = u \times \log{x} - v \times \log{y} $$ $$ \Rightarrow \dfrac{x^u}{y^v} = 10^{u \times \log{x} - v \times \log{y}} $$ $$ a + b = 2 \times \left\lfloor 10^{u \times \log{x} - v \times \log{y}} \right\rfloor + 1 $$

This formular will not work properly if the conditions are too large to handle! In order to get the AC verdict, the solution should be built by combining these all ~3~ subtasks!

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.