mirea-projects/First term/Algorithms/4/3.py
2024-09-24 02:22:33 +03:00

20 lines
400 B
Python
Executable File

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()