05 2021 档案
摘要:复杂度n^2 ,没想出来怎么优化,‘*’赋值可以差分写,不过不减复杂度 #include <queue> #include <cstdlib> #include <cmath> #include <cstdio> #include <string> #include <cstring> #inclu
阅读全文
摘要:不会的点: √进程间同步,进程间通信方式 IO多路复用 epoll select poll √ 协程 死锁 进程和线程的死锁 √ 多线程多进程 √socket怎样建立进程间的通信 √Const关键字的用法 √右值引用 √编程实现:写一下shared_ptr这个类的实现,其中该有的数据成员和函数成员,
阅读全文
摘要:select main() { int sock; FILE *fp; struct fd_set fds; struct timeval timeout={3,0}; //select等待3秒,3秒轮询,要非阻塞就置0 char buffer[256]={0}; //256字节的接收缓冲区 /*
阅读全文
摘要:服务器: #include "InitSock.h" #include #include using namespace std; CInitSock initSock; // 初始化Winsock库 int main() { // 创建套节字 SOCKET sListen = ::socket(A
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; template <typename T> class Sharedptr { public: //空参数构造, 空指针 Sharedptr():count(0), ptr((T*) 0){} //构造函数 c
阅读全文
摘要:#include<iostream> #include<bits/stdc++.h> using namespace std; class hip { public: int *a; int cnt; hip(){a=0,cnt=0;} hip(int arr[],int n) { cnt=n; a
阅读全文