Fix testing bug#1
Open
PeganovAnton wants to merge 1 commit into
Open
Conversation
If the rightmost painted cell has to be on the border of the robot pitch the cell is not painted and task testing system reports an error wrongly.
Contributor
Author
|
Мое решение к задаче #!/usr/bin/python3
from pyrob.api import *
def cell_needs_filling(cell_idx, filled_idx):
return 2 * cell_idx == filled_idx * (filled_idx - 1)
@task
def task_7_5():
"""Consider arithmetic progression with initial term `a_1 = 0`
and difference `d = 1`. Distance between `n`-th painted cell
(counting from one) and first painted cell is equal to
sum of first `n` members of the progression. Here the distance
is the difference between row indices of the painted cells.
Consider a robot passing through `n-1` painted cells and stopping
exactly before `n`-th painted cell (`n = 1, ...`).
Let the `k` be number steps made by the robot (`k = 0, ...`).
Than, in consideration of position of the first painted cell, `k`
and `n` satisfy the following equation
`k = n * (n-1) / 2` (follows from formula of sum of first members
of arithmetic progression).
"""
cell_idx = 0
filled_idx = 1
while not wall_is_on_the_right():
move_right()
if cell_needs_filling(cell_idx, filled_idx):
fill_cell()
filled_idx += 1
cell_idx += 1
if __name__ == '__main__':
run_tasks() |
Contributor
|
Спасибо за PR. Нужно поправить решение , чтобы сборка проходила корректно. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the rightmost painted cell has to be on the border of the robot pitch
the cell is not painted and task testing system reports an error wrongly.
Если крайняя клетка, которую нужно закрасить, на границе, тестирующая система ее не включает в задание.