submission_id string | problem_id string | status string | code string | input string | output string | problem_description string |
|---|---|---|---|---|---|---|
s593324197 | p00102 | Accepted | while True:
n = int(raw_input())
if n == 0:
break
else: # n > 0
table = []
for m in range(n):
line = []
line = map(int,raw_input().split())
line_sum = sum(line)
line.append(line_sum)
table.append(line)
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s557054940 | p00102 | Accepted | while True:
data=[]
n = int(input())
if n==0:
break
for i in range(n):
spam=list(map(int,input().split()))
spam.append(sum(spam))
data.append(spam)
spam=[]
for i in range(n+1):
spam.append(sum(x[i] for x in data))
data.append(spam)
for i in range(n... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s779311158 | p00102 | Accepted | while True:
n = int(raw_input())
if n == 0:
break
a = [map(int, raw_input().split()) for i in xrange(n)]
a = [l + [sum(l)] for l in a]
a.append([sum([l[i] for l in a]) for i in xrange(len(a[0]))])
print "\n".join(["".join([str(i).rjust(5) for i in l]) for l in a]) | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s371157048 | p00102 | Accepted | while(1):
n=int(raw_input())
if n==0:
break
else:
F=[]
for i in range(n):
F.append([int(x) for x in raw_input().split()])
F.append([0 for x in range(n+1)])
for i in range(n):
F[i]=F[i]+[sum(F[i])]
for j in range(n+1):
s=0
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s679291463 | p00102 | Accepted | while True:
num = input()
if num == 0: break
mrx = []
row = [0] * (num + 1)
for i in range(num):
mrx.append(map(int, raw_input().split()))
mrx[i].append(sum(mrx[i]))
for j in range(num + 1): row[j] += mrx[i][j]
mrx.append(row)
for i in mrx: print "".join([str(s).rjus... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s597776174 | p00102 | Accepted | while True:
data=[]
n=int(input())
if n==0:break
for i in range(n):
a=list(map(int,input().split(' ')))
a.append(sum(a))
data.append(a)
a=[]
for i in range(n+1):
a.append(sum(x[i] for x in data))
data.append(a)
for i in range(n+1):
for j in range(n... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s554497188 | p00102 | Accepted | while True:
N = int(raw_input())
if N == 0: break
total = None
result = []
for i in range(N):
lis = list(map(int, raw_input().split(' ')))
lis.append(sum(lis))
result.append(lis)
if total == None:
total = lis[:]
else:
for i in range(len... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s267061901 | p00102 | Accepted | def print_row(iterable):
print(''.join(map(lambda x: str(x).rjust(5), iterable)),
str(sum(iterable)).rjust(5), sep='')
while True:
n = int(input())
if n == 0:
break
m = []
for i in range(n):
m.append(list(map(int, input().split())))
last = [0 for i in range(n)]
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s420115077 | p00102 | Accepted | import sys
try:
while 1:
temp = input()
if (temp==0):
break
N = temp
a = []
for i in range(N):
a.append(map(int, raw_input().split())+[0])
a.append([0 for i in range(0,temp+1)])
for i in range(0,temp):
for j in range(0,temp):
a[i][temp] += a[i][j]
for k in range(0,temp+1):
for l in rang... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s954493329 | p00102 | Accepted | while True:
l = []
n = int(input())
if n == 0:
break
lx = [0 for i in range(n+1)]
for j in range(n):
l1 = [int(i) for i in input().split()]
c = 0
for i in l1:
c += i
l1.append(c)
for i in range(n+1):
lx[i] += l1[i]
l.append(l1)
l.append(lx)
for s in l:
a = ''
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s231687557 | p00102 | Accepted | n = int(raw_input())
while n != 0:
input_list = []
for x in range(n):
input_list.append(map(int, raw_input().split(' ')))
for x in range(n):
input_list[x].append(sum(input_list[x]))
print ''.join(map(lambda n:"{:>5}".format(n), input_list[x]))
input_len = len(input_list[0])
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s660753953 | p00102 | Accepted | from sys import stdin
if __name__ == '__main__':
# is_begin = False
for n in stdin:
if int(n) == 0:
break
# else:
# if is_begin:
# print()
# is_begin = True
bottom_total = []
right_total = []
for _ in range(int(n)):
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s470592631 | p00102 | Accepted | def output_res(row):
print(''.join(map(lambda num: str(num).rjust(5), row)), str(sum(row)).rjust(5), sep='')
def main():
while True:
n = int(input())
if n == 0:
break
bottom_total = [0 for _ in range(n)]
for _ in range(n):
each_line = list(map(int, inpu... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s302890796 | p00102 | Accepted | def print_list_inline(tr_list):
inline = map(lambda string:"{:>5}".format(string),tr_list)
inline = list(inline)
print(("").join(inline))
while True:
n = int(input())
if n != 0:
sum_col = [0 for i in range(n+1)]
for i in range(n):
list_row = list(map(int,input().split("... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s759198829 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
a = []
b = []
for i in range(n):
a.append([int(x) for x in input().split()])
for i in range(n):
a[i].append(sum(a[i]))
for i in range(n + 1):
sum_ = 0
for j in range(n):
sum_ += a[j][i]
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s768920317 | p00102 | Accepted | while 1:
n=int(raw_input())
if n==0:break
a=[map(int,raw_input().split()) for _ in xrange(n)]
ans=[[0]*(n+1) for _ in xrange(n+1)]
for i in xrange(n+1):
for j in xrange(n+1):
if i==n :
if j==n:
ans[n][n]+=sum(ans[n])
else:
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s548178123 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
a = [list(map(int, input().split())) for i in range(n)]
t = [[0 for i in range(n + 1)] for i in range(n + 1)]
for i in range(n):
for j in range(n):
t[i][j] = a[i][j]
t[i][n] += a[i][j]
t[n][j] += a[i][j]
t[n][n] += a[i][j]
for i in range(n + 1):
prin... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s748437334 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
row = n
tab = []
for i in range(row):
r = list(map(int, input().split()))
r.append(sum(r))
tab.append(r)
bel = []
for i in range(row):
tmp = 0
for j in range(row):
tmp += tab[j][i]
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s777091701 | p00102 | Accepted | while True:
Num_lis =[]
n = int(input())
if n == 0:
break
for i in range(n):
Num_lis.append(list(map(int,input().split())))
for j in range(n):
sum_num = 0
for k in range(n):
sum_num += Num_lis[j][k]
Num_lis[j].append(sum_num)
Num_lis.append([... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s428832932 | p00102 | Accepted | def rowSum(matrix):
n=len(matrix)
sumcolumn=[0]*n
for i in range(0,n):
sumcolumn[i] = sum(matrix[i])
return sumcolumn
def colSum(matrix):
n=len(matrix)
sumrow=[0]*n
for i in range(0,n):
for j in range(0,n):
sumrow[i]+=matrix[j][i]
return sumrow
while True:
n=int(input())
if n==0: br... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s886053358 | p00102 | Accepted | while 1:
n=int(input())
if n==0:break
a = []
for i in range(n):
a+=[list(map(int, input().split()))]
a[i]+=[sum(a[i])]
for j in range(n):print('%5d'%a[i][j],end='')
print('%5d'%a[i][n])
a=list(zip(*a[::-1]))
for i in range(n):print('%5d'%sum(a[i]),end='')
prin... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s194729191 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
arr = [[0] * n] * n
for i in range(n):
arr[i] = list(map(int,input().split()))
for i in range(n):
tmp = 0
for j in range(n):
tmp += arr[i][j]
arr[i].append(tmp)
last_line = []
for j in range(n... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s820275768 | p00102 | Accepted | from copy import deepcopy
def main():
while True:
n = int(input())
if n == 0:
break
tate = [0 for i in range(n)]
for i in range(n):
num = 0
m = map(int, input().split())
hoge = deepcopy(m)
tate = [x + y for (x, y) in zip... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s165164924 | p00102 | Accepted | import functools
n = int(input())
while(n):
bottom_record = [0]*(n+1)
for i in range(0, n):
l = list(map(int, input().split()))
l.append(functools.reduce(lambda x, y: x + y, l))
bottom_record = [x + y for(x,y) in zip(bottom_record, l)]
print(''.join(map('{0:5d}'.format, l)))
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s709132889 | p00102 | Accepted | n = int(input())
while(n):
bottom_record = [0]*(n+1)
for i in range(0, n):
l = list(map(int, input().split()))
l.append(sum(l))
bottom_record = [x + y for(x,y) in zip(bottom_record, l)]
print(''.join(map('{0:5d}'.format, l)))
print(''.join(map('{0:5d}'.format, bottom_record... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s765689340 | p00102 | Accepted | def main():
while True:
N = int(input())
if N == 0:
break
A = [
list(map(int, input().split(" ")))
for _ in range(N)
]
tot = [sum(col[r] for col in A) for r in range(N)]
A.append(tot)
for col in A:
col.append(su... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s939504718 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
total = [0] * (n + 1)
for i in range(n):
a = [int(i) for i in input().split()]
a.append(sum(a))
for j in range(n + 1):
print("%5d" % (a[j]), end = "")
total[j] += a[j]
print()
for i in range... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s148682965 | p00102 | Accepted | # -*- coding: utf-8 -*-
import sys
import os
for s in sys.stdin:
n = int(s)
if n == 0:
break
M = []
for i in range(n):
lst = list(map(int, input().split()))
lst.append(sum(lst))
M.append(lst)
last_lst = []
# vertical sum
for i in range(n+1):
sumv =... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s887595126 | p00102 | Accepted | def form(x, e=""):
print("{:>5}".format(x), end=e)
while True:
n = int(input())
if n == 0:
break
rows = [list(map(int, input().split())) for _ in range(n)]
for row in rows:
for r in row:
form(r)
form(sum(row), "\n")
columns = list(zip(*rows))
for column i... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s095918412 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
rows = [list(map(int, input().split())) for _ in range(n)]
for row in rows:
print("".join(map("{0:>5}".format, row)), end="")
print("{:>5}".format(sum(row)))
columns = list(zip(*rows))
print("".join(map("{0:>5}".format, list(s... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s671335581 | p00102 | Accepted | while(1):
box = []
num = int(input())
if num == 0: break
[box.append(list(map(int,input().split()))) for i in range(num)]
[box[i].append(sum(box[i])) for i in range(num)]
box_replace = list(map(list, zip(*box)))
temp = [[]]
[temp[0].append(sum(box_replace[i])) for i in range(num+1)]
box += temp
box = [list(ma... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s081963484 | p00102 | Accepted | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0102&lang=jp
"""
import sys
def solve(data):
for d in data:
d.append(sum(d))
v_sum = [0] * len(data[0])
for d in data:
for x, n in enumerate(d):
v_sum[x] += n
data.append(v_sum)
return... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s279365292 | p00102 | Accepted | import sys
def main():
for line in sys.stdin:
n = int(line)
if n != 0:
a = []
for _ in range(n):
a.append(list(map(int, input().split())))
a.append(list(range(n + 1)))
for x in range(n):
hoge = 0
for y i... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s289561912 | p00102 | Accepted | # Aizu Problem 0102: Matrix-like Computation
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
while True:
N = int(input())
if N == 0:
break
M = [[int(_) for _ in input().split()] for __ in range(N)]
for i in ... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s399743183 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
a = []
for i in range(n):
a.append([int(num) for num in input().split()])
for i in range(n):
sum = 0
for j in range(n):
sum += a[i][j]
a[i].append(sum)
a.append([])
for i in range(n + 1):
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s412786355 | p00102 | Accepted | import sys
import math
while True:
n = int(input())
if n == 0:
break
data = [list(map(int,input().split())) for i in range(n)]
data.append([0 for i in range(n+1)])
for i in range(n+1):
if i != n:
data[i].append(sum(data[i]))
for j in range(n):
data[n][i] = data[n][i]+data[j][i]
for i in range(n+1):
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s598548658 | p00102 | Accepted | import sys
#from me.io import dup_file_stdin
def print2d(m):
for r in m:
print("".join(["{:5d}".format(x) for x in r]))
#@dup_file_stdin
def solve():
while True:
n = int(sys.stdin.readline())
if n == 0 :
return
m = []
for i in range(n):
m.append(... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s015325974 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
matrix = [[] for _ in range(n)]
col_sum = [0 for _ in range(n + 1)]
for i in range(n):
matrix[i] = list(map(int, input().split()))
matrix[i].append(sum(matrix[i]))
for j in range(n + 1):
col_sum[j] += matrix[... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s920789353 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
matrix = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
sum_ = sum(matrix[i])
print(str("{:>5d}" * (n+1)).format(*matrix[i], sum_))
sum_ = [sum(e) for e in list(zip(*matrix))]
print(str("{:>5d}" * (n+1)... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s072039489 | p00102 | Accepted | while True:
inputCount = int(input())
if inputCount == 0:
break
table = []
for lp in range(inputCount):
content = [int(item) for item in input().split(" ")]
content.append(sum(content))
table.append(content)
table.append([])
for col in range(inputCount + 1):
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s626411259 | p00102 | Accepted | while 1:
n=int(input())
if n==0:break;
a=[list(map(int,input().split()))for _ in[0]*n]
for r in a:
for s in r:print(f"{s:5}",end='')
print(f"{sum(r):5}")
for c in zip(*a):print(f"{sum(c):5}",end='')
print(f"{sum([sum(r)for r in a]):5}")
| 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s642021234 | p00102 | Accepted | while 1:
n=int(input())
if n==0:break;
a=[]
for _ in[0]*n:
b=list(map(int,input().split()))
b+=[sum(b)]
a+=[b]
for s in b:print("%5d"%s,end='')
print()
for c in zip(*a):print("%5d"%sum(c),end='')
print()
| 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s239199302 | p00102 | Accepted | while 1:
n=int(input())
if n==0:break;
a=[]
for i in range(n):
a+=[list(map(int,input().split()))]
a[i]+=[sum(a[i])]
for s in a[i]:print("%5d"%s,end='')
print()
for c in zip(*a):print("%5d"%sum(c),end='')
print()
| 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s540600990 | p00102 | Accepted | while 1:
n=int(input())
if n==0:break;
a=[]
for i in range(n):
b=list(map(int,input().split()))
a+=[b+[sum(b)]]
for s in a[i]:print("%5d"%s,end='')
print()
for c in zip(*a):print("%5d"%sum(c),end='')
print()
| 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s768244877 | p00102 | Accepted | while True:
N = int(input())
if N == 0:
break
table = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(N):
n = [int(i) for i in input().split()]
for j in range(N):
table[i][j] = n[j]
for i in range(N):
for j in range(N):
table[i]... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s405163676 | p00102 | Accepted | while True:
rows = []
total = {}
n = int(input())
if (n == 0):
break
for r in range(n):
datas = map(int, input().split())
ds = list(datas)
rows.append(ds)
for r in range(n):
s = 0
for c in range(n):
s += rows[r][c]
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s073507586 | p00102 | Accepted | while True:
n = int(input())
if not n:
break
mat = []
for _ in range(n):
lst = list(map(int, input().split()))
lst.append(sum(lst))
mat.append(lst)
sum_lst = []
for i in range(len(mat[0])):
s = 0
for j in range(n):
s += mat[j][i]
sum_lst.append(s)
mat.append(sum_lst)
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s615606150 | p00102 | Accepted | while 1:
l=[list(map(int,input().split())) for i in range(int(input()))]
if not l:break
le=len(l)
for (i,j) in enumerate(l):
l[i].append(sum(j))
l.append([sum([l[k][i] for k in range(le)]) for i in range(le+1)])
[print("".join([str(j).rjust(5) for j in i])) for i in l]
| 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s491619506 | p00102 | Accepted | # AOJ 0102: Matrix-like Computation
# Python3 2018.6.17 bal4u
while True:
n = int(input())
if n == 0: break
arr = [[0 for r in range(n+2)] for c in range(n+2)]
for r in range(n):
arr[r] = list(map(int, input().split()))
arr[r].append(sum(arr[r]))
for c in range(n+1):
s = 0
for r in range(n): s += arr[r]... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s250423437 | p00102 | Accepted | import sys
while True:
a=int(input())
if a==0: break
soug,tt,te=[0]*a,[],0
for i in range(a):
hoge=map(int,raw_input().split())
te=0
for j in range(a):
te+=hoge[j]
soug[j]+=hoge[j]
sys.stdout.write("%5d"%hoge[j])
else: sys.stdout.write("%5d"%te) ; print""
else:
te=0
f... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s523320737 | p00102 | Accepted | while 2 > 1:
line_num = int(raw_input())
if line_num < 1:
break
mylist = [0,0,0,0,0,0,0,0,0,0,0]
for n in range(line_num):
dat = map(int, raw_input().split(" "))
col_num = len(dat)
row_sum = 0
for m in range(col_num):
mylist[m] += dat[m]
row_sum += dat[m]
mylist[col_num] = row_sum
disp = ""
fo... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s644568156 | p00102 | Accepted | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def solve():
while True:
n = input()
if n > 0:
mat = [[0 for i in xrange(n + 1)] for j in xrange(n + 1)]
for i in range(n):
line = sys.stdin.readline().split()
for j in range(n):
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s734272751 | p00102 | Accepted | import sys
R = lambda:map(int,raw_input().split())
while 1:
n = int(raw_input())
if n == 0: break
lst = []
for i in xrange(n):
lst.append(R())
lst[i].append(sum(lst[i]))
s = []
for i in xrange(n+1):
t = 0
for j in xrange(n):
t += lst[j][i]
s.a... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s633251264 | p00102 | Accepted | import sys
while True:
n = int(raw_input())
if n == 0: break
a = []
for i in range(n):
a.append(map(int, raw_input().split()))
for i in range(n):
a[i].append(sum(a[i]))
col_sum = []
for col in range(len(a[0])):
s = 0
for row in range(len(a)):
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s825446922 | p00102 | Accepted | while True:
n=input()
if n==0:
break
li=[[0]*(n+1) for unused in xrange(n+1)]
for i in xrange(n):
li[i][:n]=map(int,raw_input().split())
for i in xrange(n):
li[i][n]=sum(li[i])
li[n][i]=sum([li[j][i] for j in xrange(n)])
li[n][n]=sum(li[n])
print "\n".join([""... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s792042908 | p00102 | Accepted | def print_nums(nums):
print ''.join(['%5d' % num for num in nums])
while 1:
n = int(raw_input())
if n == 0: break
sums = [0] * (n + 1)
for i in range(n):
nums = map(int, raw_input().split())
nums.append(sum(nums))
print_nums(nums)
for j in range(n + 1):
s... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s899451752 | p00102 | Accepted | #coding:utf-8
ans=[]
while True:
curAns=[]
n=input()
if n ==0:
break
for i in xrange(n):
lst=map(int,raw_input().split())
lst.append(sum(lst))
curAns.append(lst)
lLst=[] #最後のリスト
for i in xrange(n+1): #横方向探索
verSum=... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s351355822 | p00102 | Accepted | import sys
f=lambda v,b: v.append(sum(b))
while True:
c=input()
if c==0: break
x=range(c)
z=range(c+1)
q={}
for i in x:
q[i]=map(int,raw_input().split())
t=q.values()[i]
f(t,t)
q[i+1]=[]
for g in x:
w=[]
for j in x:
w.append(q.values()[... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s266893223 | p00102 | Accepted | import sys
f=lambda v,b: v.append(sum(b))
while True:
c=input()
if c==0: break
x=range(c);z=range(c+1);q={}
for i in x:
q[i]=map(int,raw_input().split());t=q.values()[i];f(t,t)
q[i+1]=[]
for g in x:
w=[]
for j in x:
w.append(q.values()[j][g])
f(q[i+1]... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s423325417 | p00102 | Accepted |
import sys
def solv(matrix):
for row in matrix:
s = sum(row)
row.append(s)
r = []
l = len(matrix[0])
for c in range(l):
column = map(lambda x: x[c], matrix)
sc = sum(column)
r.append(sc)
matrix.append(r)
return matrix
while True:
n = int(sys.stdin... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s143713241 | p00102 | Accepted | while True:
n = int(raw_input())
if n == 0:
break
a = [[] for i in range(n + 1)]
for i in range(n + 1):
if i < n:
a[i] = map(int, raw_input().split())
a[i].append(sum(a[i]))
else:
a[i] = [sum([a[j][k] for j in range(n)]) for k in range(n + 1)... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s265523104 | p00102 | Accepted | while True:
n = int(raw_input())
if n == 0:
break
a = [[] for i in range(n + 1)]
for i in range(n + 1):
if i < n:
a[i] = map(int, raw_input().split())
a[i].append(sum(a[i]))
else:
a[i] = [sum([a[j][k] for j in range(n)]) for k in range(n + 1)]... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s547959415 | p00102 | Accepted | while True:
n = int(raw_input())
if n == 0:
break
a = [[] for i in range(n + 1)]
for i in range(n + 1):
if i < n:
a[i] = map(int, raw_input().split())
a[i].append(sum(a[i]))
else:
a[i] = [sum([a[j][k] for j in range(n)]) for k in range(n + 1)]... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s149093762 | p00102 | Accepted | while True:
n = int(raw_input())
if n == 0:
break
a = []
for i in range(n + 1):
if i < n:
a.append(map(int, raw_input().split()))
a[i].append(sum(a[i]))
else:
a.append([sum([a[j][k] for j in range(n)]) for k in range(n + 1)])
for aa in a:... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s401207654 | p00102 | Accepted | import sys
def solve():
while True:
n = input()
if n > 0:
mat = [[0 for i in xrange(n + 1)] for j in xrange(n + 1)]
for i in range(n):
line = sys.stdin.readline().split()
for j in range(n):
mat[i][j] = int(line[j])
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s053734275 | p00102 | Accepted | #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit
def main(readline=stdin.readline):
fmt = '{:5d}'.format
while 1:
n = int(readline())
if not n:
exit()
total = [0] * (n+1)
for _ in range(n):
s = 0
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s994396543 | p00102 | Accepted | n = int(raw_input())
while n != 0:
a = [map(int,raw_input().split()) for i in xrange(n)]
a = [l + [sum(l)] for l in a]
a.append([sum([l[i] for l in a]) for i in xrange(len(a[0]))])
print '\n'.join([''.join([str(i).rjust(5) for i in l]) for l in a])
n = int(raw_input()) | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s578668832 | p00102 | Accepted | while True:
n = int(raw_input())
if n == 0: break
ls = [map(int, raw_input().split()) for i in range(n)]+[[0]*(n+1)]
for i in range(n):
ls[i].append(sum(ls[i]))
for i in range(n+1):
for j in range(n):
ls[n][i] += ls[j][i]
for row in ls:
print ''.join(map(lambda x: str(x).rjust(5), row)) | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s458090987 | p00102 | Accepted | while True:
n = input()
if n == 0: break
ls = [map(int, raw_input().split())+[0] for i in range(n)]+[[0]*(n+1)]
for row in range(n+1):
for col in range(n):
ls[n][col] += ls[row][col] if row != n else 0
ls[row][n] += ls[row][col]
print "".join(map(lambda x: str(x).rjust(5), ls[row])) | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s643654577 | p00102 | Accepted | while 1:
n = input()
if n == 0: break
l = [map(int, raw_input().split())+[0] for i in range(n)]+[[0]*(n+1)]
for r in range(n+1):
for c in range(n):
l[n][c] += l[r][c] if r != n else 0
l[r][n] += l[r][c]
print "".join(map(lambda x: str(x).rjust(5), l[r])) | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s482905499 | p00102 | Accepted | while True:
n = input()
ans = []
if n == 0: break
tmp = [0] * (n+1)
for i in range(n):
ans.append(map(int, raw_input().split()))
ans[i].append(sum(ans[i]))
for j in range(len(ans[i])):
tmp[j] += ans[i][j]
ans.append(tmp)
for a in ans:
print "".join... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s879127931 | p00102 | Accepted | while True:
A = []
n = int(input())
if n == 0:
break
for i in range(n):
A.append(list(map(int,input().split())))
result = A[:]
result_T = list(map(list,zip(*A)))
for line in result:
line.append(sum(line))
for line in result_T:
line.append(sum(line... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s887018044 | p00102 | Accepted | while True :
n = int(input())
if n == 0 :
break
L = [0] * n
for i in range(n) :
tmp = list(map(int, input().split()))
for j in range(n) :
L[j] += tmp[j]
tmp.append(sum(tmp))
for j in range(n+1) :
print(str(tmp[j]).rjust(5), end = ""... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s964482115 | p00102 | Accepted | import sys
readline = sys.stdin.readline
write = sys.stdout.write
fmt = "{:5d}".format
def solve():
N = int(readline())
if N == 0:
return False
A = [list(map(int, readline().split())) for i in range(N)]
for ln in A:
write("".join(map(fmt, ln)))
write(fmt(sum(ln)))
write(... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s523169812 | p00102 | Accepted | while(1):
n = int(input())
if n == 0:
break
t = [[0] * (n + 1) for i in range(n + 1)]
m = []
for i in range(0,n):
m.append(list(int(x) for x in input().split(" ")))
sum = 0
for i in range(0,n):
sum1 = 0
sum2 = 0
for j in range(0,n):
t[i][j]... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s934524941 | p00102 | Accepted | while True:
n=int(input())
if n==0:
break
i=0
mat=[]
#リストを一つに
while i<n:
tmp_mat=list(map(int, input().split()))
mat.extend(tmp_mat)
i+=1
total=0
tmp_last=[0 for l in range(n+1)]
for x in range(len(mat)):
total+=mat[x]
tmp_last[x%n]+=ma... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s147377577 | p00102 | Accepted | import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog
BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)
SIZE = 51
table = [[None... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s403876781 | p00102 | Accepted | while True:
n = int(input())
if n == 0: break
arr = [[0 for r in range(n+2)] for c in range(n+2)]
for r in range(n):
arr[r] = list(map(int, input().split()))
arr[r].append(sum(arr[r]))
for c in range(n+1):
s = 0
for r in range(n): s += arr[r][c]
arr[n][c] = s
for r in range(n+1):
for c in range(n+1... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s150218959 | p00102 | Accepted | while 1:
n = int(input())
if n == 0:
break
L = []
for i in range(n):
L += [list(map(int,input().split()))+[0]]
L += [[0]*(n+1)]
for r in range(n):
for c in range(n):
L[r][n] += L[r][c]
L[n][c] += L[r][c]
L[n][n] += L[r][c]
for f in ... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s509549147 | p00102 | Accepted |
while True:
L = []
n = int(input())
if n == 0:
break
for _ in range(n):
l = [int(x) for x in input().split()]
l.append(sum(l))
L.append(l)
l = []
for i in range(len(L[0])):
s = []
for j in range(len(L)):
s.append(L[j][i])
l.ap... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s580449755 | p00102 | Accepted | while True:
n = int(input())
if n==0:
break
A=[]
for a in range(n):
x =list(map(int, input().split()))
x.append(sum(x))
A.append(x)
Y=[]
for j in range(n+1):
y=0
for i in range(n):
y+=A[i][j]
Y.append(y)
A.append(Y)
for i in range(n+1):
for j in range(n+1):
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s046573055 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
arr = [[0 for r in range(n+2)]for c in range(n+2)]
for r in range(n):
arr[r] = list(map(int, input().split()))
arr[r].append(sum(arr[r]))
for c in range(n+1):
s = 0
for r in range(n):
s += arr[r][... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s518882497 | p00102 | Accepted | # coding=utf-8
###
### for python program
###
import sys
import math
# math class
class mymath:
### pi
pi = 3.14159265358979323846264338
### Prime Number
def pnum_eratosthenes(self, n):
ptable = [0 for i in range(n+1)]
plist = []
for i in range(2, n+1):
if ptable... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s836343457 | p00102 | Accepted | while True:
n=int(input())
if n==0:
break
ts=[0]*n
ys=0
a=[]
for i in range(n):
b=list(map(int,input().split()))
s=sum(b)
a.append(b+[s])
for i in range(n):
ts[i]+=b[i]
ys+=s
t=sum(ts)
for i in range(n):
for j in ra... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s937556317 | p00102 | Accepted | while 1:
try:
N=int(input())
if N==0:break
matrix = [list(map(int,input().split())) for i in range(N)]
matrix.append([])
for i in range(N):matrix[i].append(sum(matrix[i]))
for j in range(len(matrix)):
pointer=0
for k in range(N):
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s598985056 | p00102 | Accepted | if __name__ == '__main__':
while True:
n = int(input())
if n == 0:
break
A = [[0 for _ in range(n+1)]for _ in range(n)]
B = [0 for _ in range(n+1)]
for i in range(n):
tmp = list(map(int,input().split()))
for j,k in enumerate(tmp):
A[i][j] += k
B[j] += k
A[i][n] = sum(A[i])
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s814237700 | p00102 | Accepted | while 1:
n=int(input())
if n==0:break
ans=[0]*(n+1)**2
for i in range(0,n):
keep=list(map(int,input().split()))
s_keep=0
for j in range(n):
ans[i*(n+1)+j]=keep[j]
s_keep+=keep[j]
ans[(i+1)*(n+1)-1]=s_keep
for i in range(n+1):
s_keep=0
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s165817685 | p00102 | Accepted | while 1:
n = int(input())
if n == 0:
break
mat = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
mat[i] = list(map(int, input().split()))
for i in range(n):
tmp = 0
for j in range(n):
tmp += mat[i][j]
mat[i].append(tmp)
col = [0... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s654986155 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
ans = []
sum_c = [0 for i in range(n + 1)]
for i in range(n):
r = list(map(int, input().split()))
r.append(sum(r))
ans.append(r)
for j in range(n + 1):
sum_c[j] += r[j]
ans.append(sum_c)
for i i... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s493083124 | p00102 | Accepted | while True:
n = int(input())
if n == 0: break
table = []
for _ in range(n):
num = list(map(int, input().split()))
num.append(sum(num))
table.append(num)
vertical = []
for t in zip(*table):
vertical.append(sum(t))
table.append(vertical)
for tab in table:
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s516884059 | p00102 | Accepted | while True:
n = int(input())
if n == 0:
break
mat = []
for i in range(n):
mat.append(list(map(int, input().split())))
mat[i].append(sum(mat[i]))
mat.append([0]*(n+1))
for i in range(n+1):
for j in range(n):
mat[n][i]+=mat[j][i]
for i in mat:
... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s795444576 | p00102 | Accepted | n = int(input())
while (n != 0):
nlist = []
for i in range(n):
nn = list(map(int, input().split()))
nn.append(sum(nn))
nlist.append(nn)
lastn = []
for i in range(n+1):
last = 0
for k in range(n):
last += nlist[k][i]
lastn.append(last)
nlist... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s108964665 | p00102 | Accepted | while(True):
n = int(input())
if n == 0:
break
arr = []
for i in range(n):
arr.append(list(map(int, input().split())))
arr = [ l+[sum(l)] for l in arr]
brr = [0]*(n+1)
for i in range(n):
for j in range(n+1):
brr[j] += arr[i][j]
crr = arr+[brr]
for... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s020529217 | p00102 | Runtime Error | data=[]
while True:
n = int(input())
if n==0:
break
for i in range(n):
spam=list(map(int,input().split()))
spam.append(sum(spam))
data.append(spam)
for j in spam:
print(str(j)+' ',end='')
print('')
for i in range(len(data)+1):
print(str... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s231187471 | p00102 | Runtime Error | data=[]
while True:
try:
n = int(input())
except:
break
if n==0:
break
for i in range(n):
spam=list(map(int,input().split()))
spam.append(sum(spam))
data.append(spam)
for j in spam:
print(str(j)+' ',end='')
print('')
for i i... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s055926687 | p00102 | Runtime Error | data=[]
while True:
try:
n = int(input())
except:
break
if n==0:
break
for i in range(n):
spam=list(map(int,input().split()))
spam.append(sum(spam))
data.append(spam)
for j in spam:
print('{:5}'.format(j),end='')
print('')
f... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s807580280 | p00102 | Runtime Error | data=[]
while True:
n = int(input())
if n==0:
break
for i in range(n):
spam=list(map(int,input().split()))
spam.append(sum(spam))
data.append(spam)
spam=[]
for i in range(n+1):
spam.append(sum(x[i] for x in data))
data.append(spam)
for i in range(n+1):... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s842429813 | p00102 | Runtime Error | while True:
n = input()
x = []
y = [0 for i in range(n+1)]
for i in range(n):
a = map(int, raw_input().split())
a.append(sum(a))
x.append(a)
for j in range(n+1):
y[j] += a[j]
x.append(y)
for a in x:
print "".join([str(e).rjust(5) for e in a]) | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s131477256 | p00102 | Runtime Error | while True:
num = input()
if num == 0: break
sht = []
for i in range(num):
sht.append(map(int, raw_input().split()))
sht[i].append(sum(sht[i]))
print " ".join(map(str, sht[i]))
row = []
for i in range(num + 1):
sum = 0
for j in range(num):
su... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
s413494434 | p00102 | Runtime Error | while 1:
temp = input()
if (temp==0):
break
N = temp
a = []
for i in range(N):
a.append(map(int, raw_input().split())+[0])
a.append([0 for i in range(0,temp+1)])
for i in range(0,temp):#????????¢??????
for j in range(0,temp):#????????¢??????
a[i][temp] += a[i][j]
for k in range(0,temp+1):#????????... | 4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
4
52 96 15 20
86 22 35 45
45 78 54 36
16 86 74 55
0
| 52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
52 96 15 20 183
86 22 35 45 188
45 78 54 36 213
16 86 74 55 231
199 282 178 156 815
|
<H1>Matrix-like Computation</H1>
<p>
Your task is to develop a tiny little part of spreadsheet software.
</p>
<p>
Write a program which adds up columns and rows of given table as shown in the following figure:
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640">
<... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.