| Final round of the 11th Regional Olympiad for the Governor’s Prize 2026, grades 7-8, Vologda Region |
|---|
| Finished |
There are $$$N$$$ trees in a garden, arranged in a straight line. The distance between adjacent trees is one meter. The distance from the well to the first tree is also one meter. Watering one tree requires one bucket of water.
Vasya waters the trees as follows: he fills two buckets of water at the well, walks to the last two trees to water them, then returns to the well, and the process repeats.
Your task is to find a formula that calculates the total distance Vasya travels. For example, when $$$N=3$$$, your formula should yield a result of 8.
In your formula, you may use only the following elements:
The '/' operator denotes integer division (e.g., 8 / 3 = 2, -8 / 3 = -2). The '%' operator denotes the remainder (e.g., 8 % 5 = 3, -8 % 5 = -3). Multiplication, division, and remainder operations have higher precedence than addition and subtraction. The multiplication symbol cannot be omitted.
When submitting your solution, please select PHP (you don't need to know it, it's just a feature of the system).
The correctness of your formula will be verified automatically by substituting various values of $$$N$$$ (ranging from 1 to 1000) into it. Points will be awarded for each correct answer. The maximum possible score is 100.
| Name |
|---|


