2021年4月1日
摘要: 今天新了解的打表 #include <iostream> using namespace std; long long dfs(int x) //深搜 { if(x==1) return 1; long long tot=1; //加上自身,所以初始化是 1 for(int i=1;i<=x/2;i 阅读全文
posted @ 2021-04-01 13:50 光学 阅读(49) 评论(0) 推荐(0) 编辑
2020年12月29日
摘要: #include<iostream> using namespace std; int poww(int a, int b) { int ans = 1, base = a; while (b != 0) { if (b & 1 != 0) ans *= base; base *= base; b 阅读全文
posted @ 2020-12-29 21:30 光学 阅读(63) 评论(0) 推荐(0) 编辑
2020年12月28日
摘要: #include<iostream> #include <algorithm> using namespace std; typedef struct treenode { int val; struct treenode* left; struct treenode* right; }*tree; 阅读全文
posted @ 2020-12-28 16:43 光学 阅读(127) 评论(0) 推荐(0) 编辑
2020年12月16日
摘要: #include <bits/stdc++.h> using namespace std; int c[13][13];//杨辉三角 int b[13];//用于排除 int a[13];//输出解答 int n, p; void dfs(int dep, int s) { if (s > p) r 阅读全文
posted @ 2020-12-16 20:09 光学 阅读(37) 评论(0) 推荐(0) 编辑
2020年12月12日
摘要: memset函数逐个字节赋值的,所以除了0和1这两个数字外,一般不要直接赋值。 memset(数组,赋值(0或1),数组的长度) #include<iostream> using namespace std; int main() { char a[8]; memset(a, '*', 8); fo 阅读全文
posted @ 2020-12-12 16:28 光学 阅读(32) 评论(0) 推荐(0) 编辑
摘要: #include <cstdio> #include <string.h> #include <cmath> #include <queue> using namespace std; struct xy{ int x,y; }node,Top; const int dx[4]={1,-1,2,-2 阅读全文
posted @ 2020-12-12 16:06 光学 阅读(47) 评论(0) 推荐(0) 编辑
2020年12月8日
摘要: 最近刷题的确发现动态二维数组是又麻烦又容易出错,针对这一点还是想提出一些改进的,直接赋一个大的值就好了,省去很多不必要的麻烦,如果你将这个值换为2,则会出现访问冲突的情况。 迷宫(洛谷-P1605) #include<iostream> using namespace std; int start_ 阅读全文
posted @ 2020-12-08 20:36 光学 阅读(56) 评论(0) 推荐(0) 编辑
2020年12月2日
摘要: #include<iostream> #include<cstring> using namespace std; template<typename item> class smallest_heap{ private: item heap[10001]; int len; public: sma 阅读全文
posted @ 2020-12-02 20:13 光学 阅读(231) 评论(0) 推荐(0) 编辑
摘要: shougou* a = new shougou[number]; sort函数: #include <iostream> // std::cout #include <algorithm> // std::sort #include <vector> // std::vector //以普通函数的 阅读全文
posted @ 2020-12-02 20:07 光学 阅读(36) 评论(0) 推荐(0) 编辑
2020年11月19日
摘要: #include <iostream> #include <vector> using namespace std; void merge(vector<int> &arr,int L,int mid,int R) { int *help = new int(R-L+1); int p1=L,p2= 阅读全文
posted @ 2020-11-19 21:57 光学 阅读(69) 评论(0) 推荐(0) 编辑