Home > Back-end >  Novice, consult a C operations
Novice, consult a C operations

Time:02-23

Novice, consult a operations
c + +
Title description

Define BinSearch function array element of binary search

Enter

The first line is a positive integer n (1 n 30000 or less or less), n is to find the number of natural Numbers,
The second line is natural number n ascending order not repeat X1, X2,... Xn, with a space interval, | Xn | 1000 or less
The third line is a natural number key, the key is to find the number of

O

If find success, then output the number 2: find the number and position of the key, with a space between
If find failure, then output "Error"
As in the "15 18 21 and 35 and 45, 66 69 78 88 89 93 96" looked up in 66, to find the four times, position in the eighth, the output "4 8"