//vector二分查找
#include "stdafx.h"
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> text = { 1,2,4,5,6,7,8,10,12 };
int result;
cin >> result;
auto lo = text.begin();//获得首元素的迭代器对象
auto hi = text.end();//获得尾元素的迭代器对象
auto mid = lo + (hi - lo) / 2;//中间元素迭代器
while (hi!= lo && *mid != result) {
if (result < *mid) {
hi = mid;
}
else {
lo = mid + 1;
}
mid = lo + (hi - lo) / 2;
}
if (*mid==result) {
cout << "yes"<<endl;
}
else {
cout << "no" << endl;
}
system("pause");
return 0;
}