Last active
August 30, 2024 05:58
-
-
Save AashishNandakumar/b2f02c6c1cd1d37fb66819b8f09f0e75 to your computer and use it in GitHub Desktop.
August 30th 2024 Questions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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