
C++
文章平均质量分 81
qq_43344375
这个作者很懒,什么都没留下…
展开
-
动态规划-股票买卖
LeetCode股票买卖系列一、思路1.基本思路2.空间优化3.时间优化二、例题详解1.LeetCode 121.买卖股票的最佳时机1)动规朴素版2)动规优化版3)贪心2.LeetCode 122.买卖股票的最佳时机 II1)动规朴素版2)动规优化版3)贪心3.LeetCode 123.买卖股票的最佳时机 III1)动规朴素版2)动规优化版4.LeetCode 188.买卖股票的最佳时机 IV1)动规优化版5.LeetCode 309.最佳买卖股票时机含冷冻期1)动规朴素版2)动规优化版6.LeetCode原创 2021-08-22 13:27:15 · 191 阅读 · 0 评论 -
STL1 顺序容器
STL1:顺序容器一、容器共有的成员函数二、动态数组vector,双向队列deque(支持随机访问迭代器的顺序容器)三、双向链表list(支持双向迭代器的顺序容器) 一、容器共有的成员函数 1.所有容器 int size() bool empty() 2.顺序容器和关联容器(返回迭代器的,容器适配器不支持迭代器) begin() end() rbegin() rend() iterator ...原创 2019-08-20 15:34:39 · 289 阅读 · 0 评论 -
STL2 关联容器
关联容器 一、multiset 二、set 三、multimap 四、map 例 根据学生成绩排序,查询小于输入成绩的最高成绩的学生,如果成绩一样先输出学号大的 #include <iostream> #include <map> #include <string> using namespace std; class student{ public: ...原创 2019-08-20 18:15:02 · 127 阅读 · 0 评论 -
STL3 容器适配器
容器适配器 一、stack 例:除k取余法 #include <iostream> #include <stack> using namespace std; int main(){ int n,k; stack<int> stk; cin>>n>>k; if(n==0){ cout<...原创 2019-08-21 10:21:36 · 154 阅读 · 0 评论 -
STL4.1 算法
STL4.1 算法 即函数模板,用来对容器操作,在algorithm\numeric中定义 一、不变序算法 不会改变算法作用的容器或对象,适用于所有容器 1.常见算法 min,max,min_element,max_element for_each count,count_if find,find_if,find_first_of,adjacent_find find_end,search se...原创 2019-08-22 16:51:34 · 109 阅读 · 0 评论 -
C++算法:枚举--熄灯问题,讨厌的青蛙
算法:枚举 熄灯问题 #include <cstdio> using namespace std; int n; int block[7][8],ans[7][8]; bool check_ans(){ for(int i=2;i<=6;++i){ for(int j=1;j<=6;++j){ ans[i][j]=block[...原创 2019-08-28 10:46:31 · 415 阅读 · 0 评论 -
C++ 递归:小游戏(POJ 2802),棋盘分割(POJ 1191)
递归 小游戏 #include<iostream> #include<algorithm> #include<cstring> #include<stdio.h> using namespace std; #define maxin 75 char board[maxin+2][maxin+2]; bool mark[maxin+2][maxin+2...原创 2019-09-03 09:22:12 · 843 阅读 · 0 评论 -
STL opj 顺序容器题:list,set,冷血格斗场,热血格斗场
list #include <cstdio> #include<iostream> #include<list> #include<string> using namespace std; /* new id ——新建一个指定编号为id的序列(id<10000) add id num——向编号为id的序列加入整数num merge id1 i...原创 2019-09-03 09:22:46 · 241 阅读 · 0 评论