mirea-projects/First term/Algorithms/4/3.py

20 lines
400 B
Python
Raw Normal View History

2024-09-23 23:22:33 +00:00
def main() -> None:
# Config
arr = [-1, 2, 3, 4, 7]
n = 5
# Main code
some_dict = {}
for index in range(len(arr)):
key = n - arr[index]
if some_dict.get(key) is not None:
print(some_dict[key], index)
break
if some_dict.get(arr[index]) is None:
some_dict[arr[index]] = index
if __name__ == "__main__":
main()