3.4k words 3 mins.

# 组合数求法 # 方法一 :动态规划(取模值) 利用组合数公式:Cab=Ca−1b+Ca−1b−1C^{b}_{a} = C^{b}_{a - 1} + C^{b - 1}_{a - 1}Cab​=Ca−1b​+Ca−1b−1​ 进行状态转移. 对于Cab=Ca−1b+Ca−1b−1C^{b}_{a} = C^{b}_{a - 1} + C^{b - 1}_{a - 1}Cab​=Ca−1b​+Ca−1b−1​ 的理解: CabC^{b}_{a}Cab​ 的数学含义:从有aaa 个小球的箱子中随机抽bbb 个小球的方案数. ⇔\Leftrightarrow⇔ 1....
1.3k words 1 mins.

# 扩展欧几里得算法 # 欧几里得算法 Euclidean Algorithm # 定理 对于∀非负整数x,y\forall 非负整数x,y∀非负整数x,y,均有gcd(x,y)=gcd(y,x%y)gcd(x, y) = gcd(y, x \% y)gcd(x,y)=gcd(y,x%y) # 证明 不防设 x>yx > yx>y. 令q=x/y,r=x%yq=x/y, r=x\%yq=x/y,r=x%y. (k 为正整数) ⇒x=qy+r,r=x−qy\Rightarrow x=qy + r,...
89 words 1 mins.

2024-05-01 2024-05-03 2024-05-04 2024-05-05 2024-05-09 2024-6-17 2024-05-18 2024-05-19 2024-05-26
3.1k words 3 mins.

# IO 多路复用 在进行网络通信的时候,服务端需要通过监听的文件描述符去接收客户端的请求,并为这些请求分配用于通信的文件描述符。当客户端的数据还问到达服务端网卡时,服务端会堵塞在 read 调用处,在没有多线程 / 多进程的情况下,无法实现并发. IO 多路复用就是通过单线程 / 单进程的方式去实现并发的监听,其思想是将监听这些文件描述符的工作交给内核去处理,当客户端的数据到达服务端网卡时,内核再告知应用进程,而不会堵塞。服务端. # 同步堵塞 IO (Blocking IO) # 同步非堵塞 IO (Nonblocking IO) #...
3.4k words 3 mins.

# gRPC 介绍 “gRPC is a modern open source high performance RPC framework that can run in any environment. It can efficiently connect services in and across data centers with pluggable support for load balancing, tracing, health checking and authentication. It is also applicable in last mile of...
616 words 1 mins.

# GRPC For C++ # What is RPC? RPC(Remote Procedure Call) ,远程过程调用,一种通过网络调用远程计算机的服务,而不需要了解底层网络技术的协议,使调用者可以像调用本地服务一样调用远程的方法。主要用于分布式服务器之间的通信,微服务 # RPC 框架 Dobbo Motan Tars SpringCloud gRPC Thrift # RPC 特性 RPC 是基于 HTTP2 协议的,使用的是长连接,不需要每次通信 # Windows 编译 grpc for QT 通过 git 把 github 下的 grpc 源码 clone...
941 words 1 mins.

# jsoncpp # ubuntu 编译 github 地址:https://github.com/open-source-parsers/jsoncpp/releases 解压 (后面跟上你压缩包名称) tar xzvf jsoncpp-1.9.5.tar.gz 编译 mkdir buildcd buildcmake ..make 生成的静态库文件和动态库文件在 build/lib 下方 one@one-virtual-machine:~/下载/jsoncpp-1.9.5/build/lib$ lslibjsoncpp.a libjsoncpp.so...