#C14080. Two Sum Indices Finder
Two Sum Indices Finder
Two Sum Indices Finder
You are given an array of integers and a target integer \(T\). Your task is to determine if there exist two distinct indices \(i\) and \(j\) in the array such that
[ a_i + a_j = T ]
If such a pair exists, output the indices \(i\) and \(j\) (0-indexed) separated by a space. Otherwise, output None
.
Note:
- The solution must read input from standard input (stdin) and write output to standard output (stdout).
- You can assume that the input is provided in two lines. The first line contains the elements of the array separated by spaces, and the second line contains the target integer.
inputFormat
The input consists of two lines:
- The first line contains space-separated integers representing the array.
- The second line contains a single integer representing the target \(T\).
outputFormat
If a valid pair exists, output the two indices (0-indexed) separated by a space. If no such pair exists, output None
.
3 2 4
6
1 2