机房 LCA 和 前缀和

摘要:解题思路:注意事项:参考代码:#include"bits/stdc++.h"usingnamespacestd;#definell&nb……

浮点专题c++

摘要:#include#includeusing namespace std;int main(){ double a; cin>>a; cout……

计算三角形面积

摘要:#include <iostream>#include <cmath>#include <iomanip>using namespace std;int main(……

计算线段长度

摘要:参考代码:#include <iostream>#include <iomanip>#include <cmath>using namespace std;int ……

C++ STL序列查找算法std::find_first_of()函数入门

本节我们将继续进行序列查找的学习——find_first_of()函数。find_first_of(first1,last1,first2,last2)函数的功能是:用于在第一个序列中查找第二个序列中任意一个元素的第一次出现。它的函数模型是://基本形式template<classInputIt,classForwardIt&nb

C++ STL序列查找算法std::find_end()函数入门

前面我们学习的查找算法都是单个元素进行查找,本节我们学习一个按序列进行查找的算法——find_end()。find_end(first1,last1,first2,last2)的功能是在主序列[first1,last1)中寻找最后一次出现的子序列[first2,last2),如果找到就返回最后一次出现在主序列中的子序列的起始迭代器;如果找不到就主序列的last1迭代器。举个例子,主序列是{&#39

C++ STL按条件查找算法std::find_if()函数入门

前面我们学过查找函数find(beg,end,val),本节我们将继续学习与其功能类似的函数——find_if()函数。find_if(beg , end ,pred),它的功能是在区间[beg , end)找到第一个满足pred条件的第一个元素,并返回指向该元素的迭代器;如果没有找到这个元素,则会返回end()。find_if(beg , end ,pred)中的"pred"