HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC - 2013-2014 > problem:


14-03-20. 50398 - Sum of kth Anti-diagonal

IMPC - 2013-2014

Start: Mar.16.2013 at 12:00:00 PM
Finish: Mar.16.2013 at 05:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 50386 - Conformity
• 14-01-10. 50457 - The Number of W...
• 14-01-40. 50419 - The longest bitoni...
• 14-01-50. 50795 - Trunk
• 14-03-10. 50412 - K numbers
• 14-03-20. 50398 - Sum of kth A...
• 14-03-30. 50377 - kth Permutation
• 14-03-40. 50773 - Balanced Sum Tree
• 14-03-60. 50382 - Parkside's Other ...
• 14-03-70. 50468 - Draw Matrix - 2
• 14-03-70. 50468 - Draw Matrix - 2
• 14-03-80. 50675 - Kruja Boys
• 14-03-90. 50717 - Hurdle Jumping
• 14-04-20. 50493 - n-digit kth Prime ...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Sum of kth Anti-diagonal

Question: Antidiagonal of a matrix starts from the lower left corner and goes to the upper right corner. You are given an nXn square matrix. Find the sum of kth anti-diagonal. The third anti-diagonal starts from the third row first element (6). And then, every element is connected to its upper right neigbour (first 9 and then 4).

Input specification
You will be given two integer numbers (n and k) at the beginning where 1 ≤ n ≤ 100 and 1 ≤ k ≤ n. Then, in the following n lines, you will be given n integers, which are between 0 and 1000.

Output specification
Show just one number: the sum of kth diagonal.

 Sample Input   
  5 4
  7 6 4 1 5
  5 9 7 8 7
  6 7 8 7 5
  8 8 0 4 10
  7 5 0 2 0
 Sample Output   
  23


Explanation: 8+7+7+1=23


Для отправки решений необходимо выполнить вход.

www.contester.ru