Skip to content

Commit 1f9c0b1

Browse files
committedNov 16, 2022
fix flipping of signs and total count
1 parent 0c319f1 commit 1f9c0b1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎sinch_arkad.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ def solve(matrix):
4040
best = max(candidates, key=lambda x: x[0])
4141
row, col, d = best[1]
4242
for i in range(row, row+d+1):
43-
for j in range(row, row+d+1):
43+
for j in range(col, col+d+1):
4444
matrix[i][j] *= -1
4545

4646
i = 0
4747
while i < len(lines):
4848
matrix = []
49-
for _ in range(25):
49+
while i < len(lines) and lines[i] != "":
5050
matrix.append(list(map(int, lines[i].split(" "))))
5151
i+=1
5252
i+=1
@@ -55,6 +55,7 @@ def solve(matrix):
5555
total += sum(xs)
5656
print("Total sum of matrix is", total)
5757
solve(matrix)
58+
total = 0
5859
for xs in matrix:
5960
total += sum(xs)
6061
print("NEW total sum of matrix is", total)

0 commit comments

Comments
 (0)
Please sign in to comment.