kvadrat | 프로그래밍의 벗 PivotOJ
PivotOJ

kvadrat

시간 제한: 1000ms메모리 제한: 128MB출처: CHC 2005 National Competition #1 - SeniorsBOJ 3192

문제

Magic square consists of 3x3 smaller squares, each containing a positive integer less than or equal to 20,000. 

It has a property that the sums of the numbers in each row, column and both diagonals are all equal. 

Dave had one beautiful magic square, but someone took a few (at most 3) numbers out of it. 

Write a program that will, for a given magic square with some missing numbers, determine the numbers missing

입력

Each of the three lines of input contains three numbers i.e. description of the magic square. 

Squares with missing numbers are denoted with number 0

출력

Three lines of output should contain the correctly filled magic square. 

예제

예제 1

입력
4 9 2
3 0 7
8 1 6
출력
4 9 2
3 5 7
8 1 6

예제 2

입력
0 12 12
16 10 0
8 8 14
출력
6 12 12
16 10 4
8 8 14

예제 3

입력
495 468 0
0 522 414
441 0 549
출력
495 468 603
630 522 414
441 576 549
코드를 제출하려면 로그인하세요.