09 2021 档案
摘要:// // Created by Administrator on 2021/8/11. // #ifndef C__TEST02_MANACHER_HPP #define C__TEST02_MANACHER_HPP #include <iostream> #include <vector> us
阅读全文
摘要:// // Created by Administrator on 2021/8/11. // #ifndef C__TEST02_KMP_HPP #define C__TEST02_KMP_HPP #include <iostream> #include <vector> using namesp
阅读全文
摘要:// // Created by Administrator on 2021/8/12. // #ifndef C__TEST02_MONOTONOUSSTACK_HPP #define C__TEST02_MONOTONOUSSTACK_HPP #include <iostream> #inclu
阅读全文
摘要:#include <iostream> #include <vector> using namespace std; class BackPack{ public: /* 背包1: * 给定N个物品,重量分别为正整数 * 一个背包的最大承重为整数M * 最多能带走多重的物品 * */ static
阅读全文
摘要:#include <iostream> #include <vector> #include <stack> #include <unordered_map> using namespace std; struct Node{ int pass; int end; unordered_map<cha
阅读全文
摘要:#include <iostream> #include <vector> #include <stack> #include <queue> using namespace std; struct Node{ int val; Node *left; Node *right; explicit N
阅读全文
摘要:说明 其实我后面两道题都没看。。。全搞第一题了,最开始想成图的拓扑了,还构建了一个图出来,代码越来越多,越来越离谱,后面索性就暴力递归了,还好数据比较弱飘过。祈祷大家都能找到心仪的工作! 题目 我有点忘了题目是啥了大概说一下吧 第一行输入神经网络的节点个数(一个节点代表一个算子) 第二行开始输入每个
阅读全文
摘要:图的节点 // // Created by Administrator on 2021/8/10. // #ifndef C__TEST02_NODE_HPP #define C__TEST02_NODE_HPP #include "iostream" #include <vector> using
阅读全文
摘要:问题 给出一颗二叉树,每个节点有一个编号和一个值,该值可能为负数,请你找出一个最优节点(除根节点外),使得在该节点将树分成两棵树后(原来的树移除这个节点及其子节点,新的树以该节点为根节点),分成的两棵树各 节点的和之间的差绝对值最大。请输出该节点编号,如有多个相同的差,输出编号最小的节点。 输入 4
阅读全文
摘要:前言 其实完全可以不用这么麻烦,我就是为了练习自建堆,其实大材小用 描述 实现删除字符串中出现次数最少的字符,若多个字符出现次数一样,则都删除。输出删除这些单词后的字符串,字符串中其它字符保持原来的顺序。 注意每个输入文件有多组输入,即多个字符串用回车隔开 输入描述: 字符串只包含小写英文字母, 不
阅读全文
摘要:#include <iostream> using namespace std; template<class T> class SmartPtr{ public: explicit SmartPtr():ptr(nullptr), count(new int(0)){} explicit Smar
阅读全文
摘要:多线程的栈 #include <iostream> #include <vector> #include <mutex> #include <thread> #include <stack> #include <exception> using namespace std; template<cla
阅读全文
摘要:LRU缓存 struct Node{ int key; int value; Node* next; Node* pre; Node(): key(-1), value(-1), next(nullptr), pre(nullptr){} explicit Node(int key_, int va
阅读全文