本文整理汇总了C++中vc::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ vc::begin方法的具体用法?C++ vc::begin怎么用?C++ vc::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vc
的用法示例。
在下文中一共展示了vc::begin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
int num;
cin >> num;
while (num--) {
int s;
cin >> s;
for (int k = 0; k < s; k++) {
int temp;
cin >> temp;
trains.push_back(temp);
sorted.push_back(temp);
}
sort(sorted.begin(), sorted.end());
int count = 0;
while (sorted != trains) {
for (int i = 0; i+1 < trains.size(); i++) {
if (trains[i] > trains[i+1]) {
int t= trains[i+1];
trains[i+1] = trains[i];
trains[i] = t;
count++;
}
}
}
cout << "Optimal train swapping takes "<< count << " swap(s)." <<endl;
trains.clear();
sorted.clear();
}
}
示例2: main
int main(void)
{
int num;
cin >> num;
for (int i = 0; i < num; i++) {
int temp;
cin >> temp;
board.push_back(temp);
}
sort(board.begin(), board.end());
cout << binary(0, (int) board.size()-1, 17);
}
示例3: main
int main(void)
{
int cows, stalls;
cin >> cows >> stalls;
vector<bool> grid (stalls+1, false);
umb.push_back(0);
for (int i = 0; i < cows; i++) {
int temp;
cin >> temp;
list.push_back(temp);
}
sort(list.begin(), list.end());
for (int i = 0; i < stalls; i++) {
int temp;
cin >> temp;
umb.push_back(temp);
}
}
示例4: main
int main(void)
{
int num;
cin >> num;
for (int i = 0; i < num; i++) {
int temp;
cin >> temp;
board.push_back(temp);
}
sort(board.end(), board.begin());
while (1) {
int cur = board[0]+1;
for (int i = 0; i < board.size(); i++) {
if(board[i] < cur){
cur = board[i];
board[i] = -5;
}
else if (<#condition#>)
}
}
}
示例5: main
int main(void)
{
list.push_back(4);
list.push_back(2);
list.push_back(9);
list.push_back(1);
list.push_back(3);
list.push_back(4);
list.push_back(7);
sort(list.begin(), list.end(), myfunc);
for(int i = 0; i <list.size(); i++){
cout << list[i] << endl;
}
int r, c;
cin >> r >> c;
for (int i = 0; i < num; i++) {
int temp;
cin >> temp;
list.push_back(temp);
}
}
示例6: main
//.........这里部分代码省略.........
list.push_back(433);
list.push_back(439);
list.push_back(443);
list.push_back(449);
list.push_back(457);
list.push_back(461);
list.push_back(463);
list.push_back(467);
list.push_back(479);
list.push_back(487);
list.push_back(491);
list.push_back(499);
list.push_back(503);
list.push_back(509);
list.push_back(521);
list.push_back(523);
list.push_back(541);
list.push_back(547);
list.push_back(557);
list.push_back(563);
list.push_back(569);
list.push_back(571);
list.push_back(577);
list.push_back(587);
list.push_back(593);
list.push_back(599);
list.push_back(601);
list.push_back(607);
list.push_back(613);
list.push_back(617);
list.push_back(619);
list.push_back(631);
list.push_back(641);
list.push_back(643);
list.push_back(647);
list.push_back(653);
list.push_back(659);
list.push_back(661);
list.push_back(673);
list.push_back(677);
list.push_back(683);
list.push_back(691);
list.push_back(701);
list.push_back(709);
list.push_back(719);
list.push_back(727);
list.push_back(733);
list.push_back(739);
list.push_back(743);
list.push_back(751);
list.push_back(757);
list.push_back(761);
list.push_back(769);
list.push_back(773);
list.push_back(787);
list.push_back(797);
list.push_back(809);
list.push_back(811);
list.push_back(821);
list.push_back(823);
list.push_back(827);
list.push_back(829);
list.push_back(839);
list.push_back(853);
list.push_back(857);
list.push_back(859);
list.push_back(863);
list.push_back(877);
list.push_back(881);
list.push_back(883);
list.push_back(887);
list.push_back(907);
list.push_back(911);
list.push_back(919);
list.push_back(929);
list.push_back(937);
list.push_back(941);
list.push_back(947);
list.push_back(953);
list.push_back(967);
list.push_back(971);
list.push_back(977);
list.push_back(983);
list.push_back(991);
list.push_back(997);
int n;
cin >> n;
if (n <= 1) {
cout << "not";
return 0;
}
vector<int>::iterator it;
it = find(list.begin(), list.end(), n);
if (it != list.end())
cout << "prime";
else
cout << "not";
return 0;
}