摘要: 题目传送门 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)
Live2D