#C5598. Two Sum Problem
Two Sum Problem
Two Sum Problem
You are given an array of integers and a target integer. Your task is to find the indices of the two numbers in the array such that they add up to the target. It is guaranteed that exactly one solution exists in the valid input cases. Note that the solution must satisfy the equation: $$a_i + a_j = target$$ for some indices \(i\) and \(j\) (with \(i < j\)).
Read the input from standard input and print the two indices separated by a single space on standard output.
inputFormat
The input consists of three lines:
- The first line contains an integer \(n\), representing the number of elements in the array.
- The second line contains \(n\) space-separated integers.
- The third line contains the target integer.
outputFormat
Output a single line with two integers (indices) separated by a space that represent the positions of the two numbers in the array whose sum is equal to the target.
## sample4
2 7 11 15
9
0 1