(Optional)Given an array of integers, return indices of the two numbers such that they add up to a specific target. Below the sample code is to create an array with 5 elements, and initialize each of them.
#include <iostream>
#include <array>
#include <vector>
#include <ctime>
using namespace std;
int main () {
int number[5];
number[0] = 1;
number[1] = 2;
number[2] = 3;
number[3] = 4;
number[4] = 5;
}
The input consists of n (0<n<100) samples.
Each sample consists of 2 lines.
The fisrt line of each sample consists of N input (range from 1 to 100), target sum (range from 0 to 20000).
The Second line of each samples consists of N integers of an array (range 0 to 10000).
The last line of input consists of Int(-1).
The values in the array can be equal.
There is only one pair of values added equal to the target in the array.
Output the indices by order.
输入
4 9
2 7 11 15
3 9
15 7 2
-1
输出
0 1
1 2