自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

一只小陀螺的博客

我好菜啊!

  • 博客(46)
  • 收藏
  • 关注

原创 【面试复习】汇总

2333

2020-08-08 01:47:27 399

原创 【面试复习】leetcode算法题

23333

2020-08-03 00:01:09 260

原创 【小姿势】实现简单的share_ptr

实现:template <typename T>class Shared_ptr {public: Shared_ptr() :_count(nullptr), _ptr(nullptr) {} Shared_ptr(T* ptr) :_count(new int(1)), _ptr(ptr) {} Shared_ptr(Shared_ptr<T>& sptr) : _count(&(++* sptr._count)), _ptr(spt

2021-02-08 15:27:36 224

原创 【面经】秋招的面经

腾讯IEG 8.19 17:00 一面问题STL用过哪些容器?C++map实现?怎么扩容,为什么通常是素数?vector内存管理机制操作系统三态切换进程调度方法进程间通信的方法共享内存还有什么限制:加锁了解哪些锁?redis有哪些数据结构?跳表和xx树比较怎么样?实习间做了啥redis集群?mysql和redis一致性同步?想来做游戏还是互联网codingn*m从左上到右下,只能往左或者往右,问方案数简单dp/C(n+m, n)奇怪的问题为什么参加算法竞赛

2020-08-19 23:02:39 356

原创 【面试复习】数据库

RedisMysql分布式

2020-07-30 01:37:53 87

原创 【面试复习】操作系统

进程和线程的区别进程是操作系统资源分配的最小单位,而线程是任务调度和执行的最小单位进程有自己独立的地址空间,每启动一个进程,系统都会为其分配地址空间,建立数据表来维护代码段、堆栈段和数据段,线程没有独立的地址空间,它使用相同的地址空间共享数据;(线程比进程开销小)对资源的管理和保护要求高,不限制开销和效率时,使用多进程。而要求效率高,频繁切换时,资源的保护管理要求不是很高时,使用多线程。独享: 线程ID,寄存器,堆栈共享: 进程代码段、进程的公有数据、进程打开的文件描述符、信号的处理器、进程的当

2020-07-30 01:31:19 82

原创 【小姿势】序列自动机

#include <bits/stdc++.h>using namespace std;struct SUBM { void init(string& str, int _az, char _base) { az = _az, base = _base; nxt.resize(str.length() + 2, vector<int>(az, -1)); for (int i = str.length() + 1

2020-07-28 00:24:03 101

原创 【面试复习】计算机网络

前置:争取在三天内用hexo搭个博客TCP和UDP相关TCP和UDP的区别有哪些?基于连接与无连接TCP可靠传输,UDP不可靠(尽最大努力进行报文的交付)TCP要求系统资源较多,UDP较少UDP程序结构较简单流模式(TCP)与数据报模式(UDP)TCP保证数据顺序,UDP不保证TCP如何保证传输的可靠性?数据包校验对失序数据包重新排序(TCP报文具有序列号)丢弃重复数据ACK应答+超时重传:接收方收到数据之后,会发送一个确认。而发送方发出数据之后,启动一个定时器,超时未收到接

2020-07-26 00:29:02 129

原创 【小姿势】简单的布隆过滤器(C++实现)

#include <iostream>#include <bitset>#include <vector>typedef unsigned long long ull;using namespace std;const int MAX_SIZE = 500000;const vector<int> seeds = { 11, 23, 37, 233 };ull ha(const string &str, const int &amp

2020-07-10 10:52:05 437

原创 【Go】二维切片的创建

func test() { // matrix[n, m] n, m := 4, 5 matrix := make([][]int, n) for i := 0; i < len(matrix); i++ { matrix[i] = make([]int, m) } fmt.Println(len(matrix)) fmt.Println(len(matrix[0]))}

2020-07-07 16:54:48 1654

原创 【面经】字节跳动-创新业务-服务器研发(实习)面经

字节跳动-创新业务-服务器研发(实习)面经base上海,已offer,实习搬砖ing一面进程间通讯方式TCP三次握手/四次挥手为什么要四次挥手?为什么不是六(3*2)次挥手轮流丢硬币,谁先到正面谁赢,问先手的胜率?如何变成个公平的游戏?【代码题】学课程,有先修的要求,问最少几个学期能学完,每个学期要学啥(拓扑排序稍微改一下while里的东西,加个for q.size)要开会,有一组会议开始时间,结束时间,问最多要几个会议室(DP)二面TCP三次握手/四次挥手Timewait2

2020-07-07 00:12:46 450

原创 通用的树的前中后序非递归遍历方法(Leetcode 144 145 146)

树的前中后序遍历:定义:前:中左右中:左中右后:左右中递归版本非常好写,这里不再赘述,仅考虑非递归使用栈进行遍历首先来看节点结构struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {}};以前学的版本中序class Solution {public: vector<int> inorder

2020-05-20 19:23:54 138

原创 nt实验报告之多核环境下OpenMP并行编程

多核环境下OpenMP并行编程文章目录多核环境下OpenMP并行编程一、实验环境二、实验内容三、实验目的四、实验步骤4.1 Windos下编译并运行OpenMP程序4.1.1 环境配置4.1.2 代码4.1.3 运行结果4.2 Linux平台上编译和运行OpenMP程序4.2.1 环境配置:4.2.3 运行结果4.3 多线程实现矩阵乘法4.3.1 TimeCalculate() 计时函数4.3.2 Matrix 矩阵类和矩阵乘法4.3.3 并行实现多次矩阵乘法4.3.4 并行实现单次大矩阵乘法五、性能分析

2020-05-14 00:55:49 2088 2

原创 Codeforces Round #641 div2 ABCDE & 1ABC

A.Orac and Factors题目:给你一个数每次递归地加上它自己的最小非1因数,问k次之后这个数是多少?思路:偶数一直加2,奇数先找到最小因数,加上后一定是个偶数,然后一直加2。#include <bits/stdc++.h>const int MAXN = 1e5 + 10;typedef long long ll;using namespace std; int main() { int T; cin >> T; while (T--) {

2020-05-13 14:47:24 169

原创 Min25模板 LOJ6503

#include <bits/stdc++.h>typedef long long ll;const ll MOD = 1e9 + 7;ll qp(ll a, ll b) { ll ret = 1; while (b) { if (b & 1) ret = ret * a % MOD; b /= 2; a = a * a % MOD; } r...

2019-09-04 10:23:18 146

原创 2019 ACM ICPC Xi'an University of Posts & Telecommunications School Contest

A.括号匹配题意:问一个括号环,在某一点处剪开,是否能成为一个合法的括号序列。题解:考虑左右括号数量是否相等即可。证明:不会。B. Oooooooo AAAAE题解:二分图最小点权覆盖模板题,建议自行百度学习,一下子也很难讲清楚,但真的是模板题。代码:#include <bits/stdc++ .h>#define mem(sx,sy) memset(sx,sy,siz...

2019-05-26 00:55:20 487

原创 LCA 倍增算法

const int MAXN = 1e6 + 100;struct LCA { struct edge { int from, to, w, nxt; }edges[MAXN << 3]; int head[MAXN], cnt, n; int id[MAXN], dep[MAXN], dist[MAXN]; int fa[MAXN][32]; void ad...

2019-05-11 09:53:12 279

翻译 约瑟夫环相关总结(公式法)

一、题目:nnn个人,111至mmm报数,问最后留下来的人的编号。公式:f(n,m)=(f(n−1,m)+m)%nf(0,m)=0f(n,m)=(f(n-1,m)+m)\%n \qquad f(0,m)=0f(n,m)=(f(n−1,m)+m)%nf(0,m)=0代码:复杂度O(n)O(n)O(n)typedef long long ll;ll calc(int n, ll m) { ...

2019-05-07 14:05:35 993

原创 Entirely Unsorted Sequences (BAPC2018 I)

Entirely Unsorted Sequences (BAPC2018 I)题意:问含有n(n&lt;5∗103)n(n &lt; 5*10^3)n(n<5∗103)个元素的序列的全错(含重复元素)排列方案数量。定义:全错排列为对于每个元素,比他大的都不在他的左边,比他小的都不在他的右边。题解:先考虑不含有重复元素的情况,令dp[n]dp[ n]dp[n]为含有n...

2019-05-07 08:56:52 500

原创 因数分解模板

因数分解typedef long long ll;#define pli pair<ll, ll>vector<pli> factor;void init(ll n) { factor.clear(); for (ll i = 2; i * i <= n; i++) { if (n % i == 0) { factor.emplace_ba...

2019-01-05 20:25:14 292

原创 2018-2019 ACM-ICPC, Asia Shenyang现场赛C && CodeForces 101955C

题意:n[1,50],k[1,50],p[1e8,1e9].求有多少 1 到 n 的排列满足:将前 k 个的数排列以后,最长上升子序列长度为 n−1 以上。瞎搞:用next_permutation打表,然后肉眼找出规律。打表代码。#include &lt;bits/stdc++.h&gt;#define mem(sx, sy) memset(sx, sy, sizeof...

2018-12-02 00:17:03 742

原创 2018牛客 国庆Day6 J-最短路

链接:https://www.nowcoder.com/acm/contest/206/J题目描述给一个连通图,每次询问两点间最短路。每条边的长度都是1。输入描述:第一行两个整数n和m,表示图的点数和边数(1 ≤ n ≤ 100000, 1 ≤ m  ≤ n+100)。接下来m行每行两个整数a和b,表示一条边(1 ≤  a, b ≤  n)。保证没有自环和重边。保证图连通。接下...

2018-10-07 12:09:20 347

原创 RMQ ST表 模板

int dp[maxn][20];void RMQinit(int n) { for (int i = 1; i &lt;= n; i++) { dp[i][0] = height[i]; } int m = int(log((double)n) / log(2.0)); for (int i = 1; i &lt;= m; i++) { for (int j = 1; j +...

2018-09-28 15:21:26 128

原创 POJ 2449 Remmarguts' Date 第K短路 A* + dij

A*/第k短路模板题#include &lt;iostream&gt;#include &lt;vector&gt;#include &lt;cstdio&gt;#include &lt;string&gt;#include &lt;cstring&gt;#include &lt;map&gt;#include &lt;algorithm&gt;#include &lt

2018-09-21 13:13:41 140

原创 LCA RMQ ST表优化 模板

struct LCA { struct edge { int from, to, w, nxt; } edges[maxn << 3]; int head[maxn << 1], cnt1; int id[maxn << 1], in[maxn << 1], Dep[maxn << 1], Dist[maxn <&lt...

2018-09-21 01:03:50 166

原创 ACM-ICPC 2018 焦作赛区网络预赛 E - Jiu Yuan Wants to Eat

You ye Jiu yuan is the daughter of the Great GOD Emancipator. And when she becomes an adult, she will be queen of Tusikur, so she wanted to travel the world while she was still young. In a country, sh...

2018-09-16 11:14:02 218

原创 ACM-ICPC 2018 焦作赛区网络预赛 L - Poor God Water

//#include &lt;iostream&gt;#include &lt;vector&gt;#include &lt;cstdio&gt;#include &lt;string&gt;#include &lt;cstring&gt;#include &lt;map&gt;#include &lt;algorithm&gt;#include &lt;queue&a

2018-09-15 19:42:13 548

原创 ACM-ICPC 2018 焦作赛区网络预赛 B-Mathematical Curse

题目A prince of the Science Continent was imprisoned in a castle because of his contempt for mathematics when he was young, and was entangled in some mathematical curses. He studied hard until he reac...

2018-09-15 18:51:58 277

原创 ACM-ICPC 2018 焦作赛区网络预赛 G-Give Candies

欧拉降幂裸题a^b mod c = a ^ (b mod φ(c) - φ(c)) mod c;题目 输入n 求 2^(n-1) mod 1e9+7#include &lt;iostream&gt;#include &lt;vector&gt;#include &lt;cstdio&gt;#include &lt;string&gt;#include &lt;cstring&...

2018-09-15 18:24:59 174

原创 ACM-ICPC 2018 徐州赛区网络预赛 J-Maze Designer (最大生成树+LCA)

题意:一个N*M的矩形,每个格点到其邻近点的边有其权值,需要构建出一个迷宫,使得构建迷宫的边权之和最小,之后Q次查询,每次给出两点坐标,给出两点之间的最短路径分析:可以把每个格点视作视作图的点,隔开两点的边视作图的边,则构建迷宫可以视作求其生成树,剩余的边就是组成迷宫的墙.因为要花费最小,所以使删去的墙权置最大即可,呢么就是求最大生成树即可.然后每次查询相当于查这个最大生成树上任意...

2018-09-10 12:56:26 494

原创 ACM-ICPC 2018 南京赛区网络预赛 E-AC Challenge

Dlsj is competing in a contest with n (0 &lt; n ≤ 20) problems. And he knows the answer of all of these problems.However, he can submit ii-th problem if and only if he has submitted (and passed, of ...

2018-09-02 15:15:26 189

原创 ACM-ICPC 2018 南京赛区网络预赛 B-The writing on the wall

Feeling hungry, a cute hamster decides to order some take-away food (like fried chicken for only 3030 Yuan).However, his owner CXY thinks that take-away food is unhealthy and expensive. So she deman...

2018-09-02 13:39:59 579 5

原创 ACM-ICPC 2018 南京赛区网络预赛 L-Magical Girl Haze

There are N cities in the country, and MMdirectional roads from uu to v(1 ≤ u, v ≤ n). Every road has a distance ci​. Haze is a Magical Girl that lives in City 1, she can choose no more than KK roads ...

2018-09-02 12:23:56 274

原创 ACM-ICPC 2018 南京赛区网络预赛 A-An Olympian Math Problem

Alice, a student of grade 66, is thinking about an Olympian Math problem, but she feels so despair that she cries. And her classmate, Bob, has no idea about the problem. Thus he wants you to help him....

2018-09-01 20:40:05 247

转载 C++ bitset——高端压位卡常题必备STL

C++ bitset——高端压位卡常题必备STLbitset存储二进制数位。bitset就像一个bool类型的数组一样,但是有空间优化——bitset中的一个元素一般只占1 bit,相当于一个char元素所占空间的八分之一。bitset中的每个元素都能单独被访问,例如对于一个叫做foo的bitset,表达式foo[3]访问了它的第4个元素,就像数组一样。bitset有一个特性:整数...

2018-08-14 21:23:45 434

原创 UVa OJ 120 - Stacks of Flapjacks (烙饼叠)

BackgroundStacks and Queues are often considered the bread and butter of data structures and find use in architecture, parsing, operating systems, and discrete event simulation. Stacks are also impo...

2018-07-25 11:02:08 141

原创 7.23 贪心 Yogurt factory (POJ 2393)

题目:DescriptionThe cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 &lt;= N &lt;= 10,000) weeks, the price of milk and labor will fluctuate weekly such ...

2018-07-25 09:28:10 304

原创 PTA 09-排序2 Insert or Merge(25 分)

题目:According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data...

2018-05-03 10:32:06 554

原创 PTA 09-排序3 Insertion or Heap Sort(25 分)

题目:According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data...

2018-05-02 17:03:27 1109

转载 STL heap相关

STL中并没有把heap作为一种容器组件,heap的实现亦需要更低一层的容器组件(诸如list,array,vector)作为其底层机制。Heap是一个类属算法,包含在algorithm头文件中。虽然STL中关于heap默认调整成的是大顶堆,但却可以让用户利用自定义的compare_fuction函数实现大顶堆或小顶堆。heap的低层机制vector本身就是一个类模板,heap基于vector便实...

2018-05-01 23:53:21 109

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除