上一页 1 ··· 75 76 77 78 79 80 81 82 83 ··· 171 下一页
摘要: 理解与感悟 1、数据结构为数组,保存完美二叉树。 2、完美二叉树的固定的位置记录,可以方便找到左儿子,右儿子。 3、如果树的高度为$h$,那么结点的个数为$2^h-1$个。这个就是个二进制数的表示法,所有小哥的和,等于大哥的力量减1. 4、国家的概念不重要,国家的概念只是整体数据结构“比赛树”的叶子 阅读全文
posted @ 2021-07-30 11:43 糖豆爸爸 阅读(90) 评论(0) 推荐(0)
摘要: 题目传送门 一、双链表解法 1、需要记录原始数据$a[i]$,索引$i$:第几天,值:多少钱。 2、为了按金额排序,同时还需要记录相应的第几天,所以引入了结构体。 3、按结构体排序后的结果组成了一个双链表,本质上就是按金额从小到大排序的链,而链表中保存的数据是天数,注意,是天数,而不是金额。就是哪一 阅读全文
posted @ 2021-07-30 08:20 糖豆爸爸 阅读(116) 评论(0) 推荐(0)
摘要: 题目传送门 C++代码 #include<bits/stdc++.h> using namespace std; const int N = 100010; int a[N], b[N]; int stk[N], tt; int n, q; //纯模拟算法 int main() { cin >> q 阅读全文
posted @ 2021-07-29 16:17 糖豆爸爸 阅读(199) 评论(0) 推荐(0)
摘要: 题目传送门 c++代码 #include <bits/stdc++.h> using namespace std; const int N = 100010; //用数组模拟栈 char stk[N], tt; //内容是第几个 //原字符串 string s; int b[N]; int main 阅读全文
posted @ 2021-07-29 16:01 糖豆爸爸 阅读(81) 评论(0) 推荐(0)
摘要: 题目传送门 c++ 代码 #include <bits/stdc++.h> using namespace std; int n, t, k, x; //国籍的桶 unordered_map<int, int> _map; int res; struct person { int nation; / 阅读全文
posted @ 2021-07-29 15:10 糖豆爸爸 阅读(274) 评论(0) 推荐(0)
摘要: 题目传送门 C++代码 #include <bits/stdc++.h> using namespace std; const int N = 1010; int m, n, cnt; //思路:队列+桶 bool b[N]; //判断该数是否在内存中,桶。 queue<int> q; //定义一个 阅读全文
posted @ 2021-07-29 15:01 糖豆爸爸 阅读(57) 评论(0) 推荐(0)
摘要: 题目传送门 一、双链表示意图 二、C++代码 #include <bits/stdc++.h> using namespace std; //双链表模板 const int N = 100010; int e[N]; //数据 int l[N]; //左链表 int r[N]; //右链表 int 阅读全文
posted @ 2021-07-29 14:30 糖豆爸爸 阅读(219) 评论(0) 推荐(0)
摘要: 题目传送门 理解与感悟 用队列思想解决约瑟夫问题是最直白的,看来不管是哪个问题,都有一种最合适的解法。 #include <bits/stdc++.h> using namespace std; int n, m; queue<int> q; int main() { //读入n个人,数到m的人 c 阅读全文
posted @ 2021-07-29 13:38 糖豆爸爸 阅读(129) 评论(0) 推荐(0)
摘要: 题目传送门 #include <bits/stdc++.h> using namespace std; //后缀表达式 stack<int> n; int s, x, y; /** .是每个数字的结束标志 @是整个表达式的结束标志 测试用例 : 3.5.2.-*7.+@ 3*(5–2)+7 16 * 阅读全文
posted @ 2021-07-29 11:55 糖豆爸爸 阅读(68) 评论(0) 推荐(0)
摘要: 题目传送门 #include <bits/stdc++.h> using namespace std; int n, m; const int N = 310; //地图 char a[N][N]; int x, y; //Bessie的起始点 //是不是访问过了 int st[N][N]; //放 阅读全文
posted @ 2021-07-28 15:00 糖豆爸爸 阅读(92) 评论(0) 推荐(1)
上一页 1 ··· 75 76 77 78 79 80 81 82 83 ··· 171 下一页
Live2D