• 1
    Input and Output Data
    • Tasks
  • 2
    Conditions
    • Tasks
  • 3
    For Loop
    • Tasks
  • 4
    Strings
    • Tasks
  • 5
    While Loop
    • Tasks
  • 6
    Lists
    • Tasks
  • 7
    Two-Dimensional Arrays
    • Tasks
  • 8
    Dictionaries
    • Tasks
  • 9
    Sets
    • Tasks
  • 10
    Functions and Recursion
    • Tasks
  • к

Занятие 7. Two -dimensional arrays

Difficulty level:

Task«Dubbleons of the main diagonal»

The old Captain Flint hid the treasures on the island. He has a map of the island, which is a square grid. Each mesh cell contains a number indicating the amount of gold dublons hidden in this cage. Captain Flint left the hint: the treasures are in the chest, buried in the cells of the main diagonal of the card.
rn
You need to Help the pirate team determine the total number of dublons hidden in the chest on the main diagonal of the card.

Input format

the first line contains an integer & nbsp; n & nbsp;-the dimension of the square matrix (maps Islands).
The following & nbsp; n & nbsp; the lines contain on & nbsp; n of integers, separated by spaces, which are a map of the island

Output format

one number-the total number of dublons hidden in the main diagonal of the card

Example

Input

3
1 2 3
4 5 6
7 8 9

Output

1 7 10

Hint

There will be no clue here, decide for yourself!

main.py
Test 1
Test 2
Test 3
Test 4
Test 5
Test 6
Test 7
Test 8
Test 9
Test 10
Developer’s solution

🎉 Congratulations! 🎉

You did an excellent job with the task! It was a challenging problem, but you found the correct solution. You are one step closer to mastering programming! Keep up the good work, because every stage you pass makes you even stronger.

AD

Advertisement

red-snake blue-snake green-snake

Running your code...

Помощник ИИ

Привет! Я твой помощник по программированию. Задавай любые вопросы по Python, я могу рассказать о функциях, методах, обьяснить то, что тебе не понятно, а так же о текущей задаче!