-->
当前位置:首页 > 题库

PROGRAMMING:Half search

Luz5年前 (2021-05-10)题库496
Title Description
In an ordered one-dimensional array, enter a number, and use the half search method to find the number which is the number in the array; If the number is not in the array, output "no data!"
###Input format:
In the first line, enter an integer n (1 < = n < = 15), which means that the array has several numbers; In the second line, enter n integer one-dimensional arrays; On the third line, enter the number you want to find.
###Output format:
If the number is found, output "it's position is 4!"; If not, output "no data!".
###Input sample 1:
Here is a set of inputs. For example:
```in
five
-3 2 7 15 40
fifteen
```
###Output sample 1:
The corresponding output is given here. For example:
```out
It's position is 4!
```
###Input sample 2:
Here is a set of inputs. For example:
```in
four
0 3 6 9
five
```
###Output sample 2:
The corresponding output is given here. For example:
```out
No data!
```






answer:If there is no answer, please comment