Skip to content

Instantly share code, notes, and snippets.

@AashishNandakumar
Last active August 30, 2024 05:58
Show Gist options
  • Select an option

  • Save AashishNandakumar/b2f02c6c1cd1d37fb66819b8f09f0e75 to your computer and use it in GitHub Desktop.

Select an option

Save AashishNandakumar/b2f02c6c1cd1d37fb66819b8f09f0e75 to your computer and use it in GitHub Desktop.
August 30th 2024 Questions
def target_practice():
# hardcode the target matrix since it is always 10 * 10 matrix with fixed values
target = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 2, 2, 2, 2, 2, 2, 2, 2, 1],
[1, 2, 3, 3, 3, 3, 3, 3, 2, 1],
[1, 2, 3, 4, 4, 4, 4, 3, 2, 1],
[1, 2, 3, 4, 5, 5, 4, 3, 2, 1],
[1, 2, 3, 4, 5, 5, 4, 3, 2, 1],
[1, 2, 3, 4, 4, 4, 4, 3, 2, 1],
[1, 2, 3, 3, 3, 3, 3, 3, 2, 1],
[1, 2, 2, 2, 2, 2, 2, 2, 2, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
]
res = 0
for i in range(10):
string = input()
for index, char in enumerate(string):
if char != ".":
res += target[i][index]
return res
t = int(input())
for _ in range(t):
print(target_practice())
def goals_of_victory():
n = int(input())
a = list(map(int, input().split()))
return -sum(a)
t = int(input())
for _ in range(t):
print(goals_of_victory())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment