| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 10 초 | 512 MB | 571 | 336 | 307 | 60.433% |
You are to find the sum of the outer number of an isosceles right triangle.
For example, for n = 5 the isosceles right triangle grid are filled with non-negative integers that are less than 100:
5 1 8 9 6 1 2 7 2 6 3 5 7 8 9
The sums of the outer integers are calculated as below:
sum = 5 +たす 1 +たす 9 +たす 2 +たす 3 +たす 5 +たす 7 +たす 8 +たす 9 +たす 6 +たす 1 +たす 8 =わ 64
The input consists of a few test cases. For each test case, the first line of input is a positive integer n (n <= 10) that determines the dimension of the triangle. Each of the next n lines contains 1 to n integers respectively that will fill the isosceles right triangle. Input is terminated by a case where n is 0.
Each line of output will start with “Case #:” where # is replaced by the case number. Then you have to output the sum of the outer numbers of the triangle.
5 5 1 8 9 6 1 2 7 2 6 3 5 7 8 9 3 1 2 3 4 5 6 0
Case #1:64 Case #2:21
ICPC > Regionals > Asia Pacific > Malaysia > Malaysia National Programming Contest > Al-Khawarizmi National Programming Contest 2016 J번