![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
-小小小小魔王-
小白上路ing……
展开
-
笔记——queue
queue是面对队列使用的使用queue之前,要先利用构造函数一个队列对象,才可以进行元素的入队,出队,取队首和队尾等操作;#include <iostream>#include <queue>using namespace std; //这几个头文件必不可少int main(){queue<类型(如int)> q; //使用前需定义一个queue变量,且定义时...原创 2018-05-18 19:32:32 · 115 阅读 · 0 评论 -
HDU1312——Red and Black (DFS)
Red and BlackTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12907 Accepted Submission(s): 7983Problem DescriptionThere is a rectangular room...原创 2018-05-27 20:04:43 · 101 阅读 · 0 评论 -
HDU1012——判断素数
1.简单暴力的方法 判断[2,n-1]区间有没有约数即可 int isPrime(int n) { int i; for (i = 2; i < n; ++i) { if (n % i == 0) return 0; } return 1; } 2.用sqrt(n) 约数都在sqrt(n)这个数的两边对应出现,所以...原创 2018-05-16 19:08:30 · 200 阅读 · 0 评论 -
HDU1241——Oil Deposits (DFS)
题目:The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvCompworkswithonelargerectangularregionoflandatatime,andcreatesagridthatdivides the land into nu...原创 2018-05-23 20:20:42 · 155 阅读 · 0 评论 -
compaper 函数 C++中
compare函数用来进行字符串以及其子串的比较,示例如下: #include <iostream> #include <string> #include <cctype> using std::cout; using std::endl; using std::cin; using std::string; int ma...原创 2018-10-13 16:20:17 · 261 阅读 · 0 评论 -
STL——Binary search(二分查找)
转自:http://www.cnblogs.com/wkfvawl/p/9475939.html二分算法模板:while (left <= right) { int mid = (left + right) / 2; if (array[mid] == key) { return mid; } ...转载 2019-03-01 18:41:56 · 137 阅读 · 0 评论