Can you solve this equation?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 11044 Accepted Submission(s): 5083
Problem Description
...
分类:
其他好文 时间:
2015-04-09 08:51:31
阅读次数:
108
#include
using namespace std;
/*
二分查找法
优点:查找速度快,平均性能好。
缺点:待查表为有序表
*/
int main()
{
int binSearch(const int*, int, int, int);
int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
cout
return ...
分类:
编程语言 时间:
2015-04-09 01:02:06
阅读次数:
152
题目:
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array....
分类:
其他好文 时间:
2015-04-08 21:37:53
阅读次数:
88
题目链接:http://poj.org/problem?id=2002测试数据:41 00 11 10 090 01 02 00 21 22 20 11 12 14-2 53 70 05 20有两种解法,第一种用二分查找,第二种用到hash存储:解法一: 1 #include 2 #include ...
分类:
其他好文 时间:
2015-04-08 14:41:11
阅读次数:
123
1 int binary_search(int* a, int len, int goal) 2 { 3 int low = 0; 4 int high = len - 1; 5 while(low goal)12 high = middle - ...
分类:
其他好文 时间:
2015-04-07 23:11:31
阅读次数:
134
I just don't want to regret it !
#include
#include
#include
#include
using namespace std;
int main()
{
vectorc{1, 2, 3, 4, 5};//默认排好了序
auto beg = c.begin();auto end = c.end();//搜索...
分类:
编程语言 时间:
2015-04-07 21:40:07
阅读次数:
125
【题目】
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).
You may assume that the intervals were initially sorted according to their start t...
分类:
其他好文 时间:
2015-04-07 17:37:24
阅读次数:
118
1 #include 2 #include 3 4 5 int main() 6 { 7 int a[10000],n,m,i,j,k,low,high,mid,flag; 8 scanf("%d",&n); 9 for(i=0; ia[mid])46 ...
分类:
其他好文 时间:
2015-04-06 17:10:14
阅读次数:
90
源代码:#include #include using namespace std;typedef struct _Table{ int data[100]; int length;}Table;int BinarySearch(Table a, int k){ int left ...
分类:
其他好文 时间:
2015-04-06 12:50:50
阅读次数:
121