编辑距离与进阶题型解析
工具函数
#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
for (auto x : v) {
os << x << "\t";
}
os << '\n';
return os;
}
template <typename T>
ostream& operator<<(ostream& os,...
Lcs 的几种写法与回溯找lcs 字符串
https://leetcode.cn/problems/longest-common-subsequence/description/?envType=problem-list-v2&envId=dynamic-programming
ref https://leetcode.cn/problems/longest-common-subsequence/solutions/2133188/jiao-ni-yi-bu-bu-si-kao-dong-tai-gui-hua-lbz5
””
a
c
e
””
0
...
Shell的炫酷效果peace for all
写在前面
在 xhs 看到了一个有意思的图片, 想试试能不能把内容反解出来. (后来还是求助了大模型 hh)
shell 源码
Linux/MacOS 下运行良好.
#!/bin/bash
text=" PEACE FOR ALL PEACE FOR ALL "
# 获取终端尺寸
cols=$(tput cols)
lines=$(tput lines)
text_length=${#text}
# 频率和幅度控制
freq=0.3
amplitude=10
# 隐藏光标,恢复时清屏
tput civis
trap "tput cnorm; clear; exit" SIGINT
# 无限动画循环
for (( t = 0; ; t++ )); ...
Macos Virtual Machine Benchmark
写在前面
环境
macOS 15.5
xcode 26beta
M2 16GB
container run -it --arch amd64 --name fedora_amd fedora
container start fedora_amd
container exec -it fedora_amd bash
测试命令
==> sysbench --version
sysbench 1.0.20
# 单核性能
sysbench cpu --cpu-max-prime=20000 --threads=1 run
# 多核性能
sysbench cpu --cpu-max-prime=20000 --threads=4 run
指标
CPU spee...
Macos下c,c++编译器llvm gcc路径与源码位置
写在前面
在下面的位置中写入(先mkdir bits)
stdc++.h文件内容:
参考 gcc 源码 gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/precompiled/stdc%2B%2B.h;
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2023 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redis...
共计 492 篇文章,62 页。
您是Zorch的第 个小伙伴
Hits