Prázdny
Prázdny

Task 2 was revealed 15.10.2024 at 18:00 CET

Login required

*

 Available from 15.10.2024 18:00 CET until 16.10.2024 17:59 CET - You can get 2 points

Due to faulty input file, this task does not have a solution and will not be evaluated and taken into consideration. We sincerely apologise.

*

 

Diamond amount/sum

Game story

Everyone is familiar with the chessboard problem, where the first square is filled with one, the second with two, the third with four, and so on, more and more grains of rice, doubling the previous number, going from cell to cell and from row to row. The question is how many grains of rice are there in total on the entire chessboard.

BUT! In this case, this is not exactly the question! Have something simpler and have something more complicated in this task!

The numbers in the cells only increase one by one, but the table can only have an odd number of elements and almost any size. The bonus is how you choose the cells that are important to you!

I wish you a good and successful puzzle!

 

Hint on the country of task provider

First Metro in Europe: our capital was the first city in continental Europe to have an underground metro system, which opened in 1896. It is still in operation today, and also known as the Millennium Underground Railway.

 

 

Task description

A square grid of size NxN (N is odd) is given. In the cells are integers from 1 to N2 have been written consecutively in ascending order.

The sum of the numbers lying along the segments connecting the midpoints of the sides of the square is called the diamond sum.

Calculate the remainder of the sum of diamonds of the specified size grid divided by 987654321.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

 

In this case the sum will be (3+7+9+11+15+17+19+23) % 987654321 = 104 % 987654321 = 104

Input: N, where N is odd and (3 <= N <= 1018) conditions are met.

Output: The diamond sum of the grid is modulo 987654321.

 

 

Example input:
5

Example output:
104

 

 

Your task

Read input file with 3 inputs N. Into the field with the answer, enter:

  • the resulting values for each of the input N on a new line
  • the country, which the hint refers to
  • at the end paste the source code of your program.

 Click here to download the TASK 2 input file

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Answer

 

Due to faulty input file, this task does not have a solution and will not be evaluated and taken into consideration. We sincerely apologise.

Hungary

 

All the competitors receive full amount of points.

 

 

 

If you want try, here are correct input values (without evaluation and points):

137

31415

20241223

 

 

 

Correct results:

2552720

77391374

464692980

 

     

Points

Correct answer

Country

Source Code

Round 1

1

1

1

Round 2

2

1

1

Round 3

3

1

1

Round 4

4

1

1

Round 5

5

1

1

                 

 

Bonus points 

Quick and correct answer

 

Round 1

5

4

3

2

1

       

Round 2

                 

Round 3

7

6

5

4

3

2

1

   

Round 4

8

7

6

5

4

3

2

1

 

Round 5

9

8

7

6

5

4

3

2

1