1568: [分治算法]二分查找
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:11
Solved:6
Description
二分查找 bsearch.pas/c/cpp
输入n个(n<=10000)从小到大排序好的整数,输入一个数x,用二分查找算法,找出该数字的位置。
Input
【输入格式】
第一行一个数字n,表示有n个整数
接下来n行,每行一个整数
最后一行,一个整数,表示要查找的数据。
Output
【输出格式】
一行,若存在则输出位置,若不存在则输出"not find"
Sample Input Copy
5
1
2
3
4
5
4
Sample Output Copy
4