当前位置: 首页 > news >正文

2023牛客第七场补题报告C F L M

2023牛客第七场补题报告C F L M

C-Beautiful Sequence_2023牛客暑期多校训练营7 (nowcoder.com)

思路

观察到数组一定是递增的,所以从最高位往下考虑每位的1最多只有一个,然后按位枚举贪心即可。

代码

#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve();
signed main(){cin.sync_with_stdio(0);cin.tie(0);int T = 1;cin >> T;while(T--){solve();}return 0;
}const int N = 1e6 + 5;
bool bit[N][32];
int nok[32][2];
void dfs(int l, int r, int d){//cout << " " << d << " " << l << " " << r << "\n";if(d < 0 || l >= r)return;int conv = 0;int id = l - 1;for(int i = l;i < r;i++){if(bit[i][d] != bit[i + 1][d]){id = i;conv++;}}if(conv > 1){nok[d][0] = 1;nok[d][1] = 1;return;}	else if(conv == 1){if(bit[l][d] == 0){nok[d][1] = 1;}else{nok[d][0] = 1;}dfs(l, id, d - 1);dfs(id + 1, r, d - 1);}else{dfs(l, r, d - 1);}}
void solve(){int n,k;cin >> n >> k;vector<int> b(n + 1);for(int i = 1;i < n;i ++) {cin >> b[i];} for(int i = 0;i <= 30;i++){nok[i][0] = 0;nok[i][1] = 0;}for(int i = 1;i <= n;i ++) {for(int j = 0;j <= 30;j ++) {if(i == 1){bit[i][j] = 0;}else{bit[i][j] = (bit[i - 1][j] ^ ((b[i - 1] >> j) & 1));}}}dfs(1, n, 30);for(int i = 0;i < 30;i++){if(nok[i][0] == 1 && nok[i][1] == 1){cout << "-1\n";return;}}long long rag = 1;for(int i = 0;i <= 30;i++){if(nok[i][0] == 0 && nok[i][1] == 0){rag <<= 1;}}if(rag < k){cout << "-1\n";}else{k--;long long ans = 0;for(int i = 0, kk = 0;i <= 30;i++){if(nok[i][0] == 0 && nok[i][1] == 0){if((k >> kk) & 1){ans |= 1 << i;}kk++;}else if(nok[i][1] == 0){ans |= 1 << i;}}if(ans >= (1ll << 30)){cout << "-1\n";}else{cout << ans << " ";for(int i = 1;i < n;i++){ans = ans ^ b[i];cout << ans << " ";}cout << "\n";}}
}

F-Counting Sequences_2023牛客暑期多校训练营7 (nowcoder.com)

思路

考虑到数据范围很大,先想的dp会t,可以使用多项式乘法,n次幂乘以m次幂就可以变换为n+m,此时直接输出多项式幂次的第k项即可。

代码

#include <bits/stdc++.h>
using namespace std;void solve();int main(){cin.sync_with_stdio(0);cin.tie(0);int T = 1;//cin >> T;while(T--){solve();}return 0;
}constexpr int P = 998244353;
using i64 = long long;
// assume -P <= x < 2P
int norm(int x) {if (x < 0) {x += P;}if (x >= P) {x -= P;}return x;
}
template<class T>
T power(T a, int b) {T res = 1;for (; b; b /= 2, a *= a) {if (b % 2) {res *= a;}}return res;
}struct Z {int x;Z(int x = 0) : x(norm(x)) {}int val() const {return x;}Z operator-() const {return Z(norm(P - x));}Z inv() const {assert(x != 0);return power(*this, P - 2);}Z &operator*=(const Z &rhs) {x = i64(x) * rhs.x % P;return *this;}Z &operator+=(const Z &rhs) {x = norm(x + rhs.x);return *this;}Z &operator-=(const Z &rhs) {x = norm(x - rhs.x);return *this;}Z &operator/=(const Z &rhs) {return *this *= rhs.inv();}friend Z operator*(const Z &lhs, const Z &rhs) {Z res = lhs;res *= rhs;return res;}friend Z operator+(const Z &lhs, const Z &rhs) {Z res = lhs;res += rhs;return res;}friend Z operator-(const Z &lhs, const Z &rhs) {Z res = lhs;res -= rhs;return res;}friend Z operator/(const Z &lhs, const Z &rhs) {Z res = lhs;res /= rhs;return res;}friend std::istream &operator>>(std::istream &is, Z &a) {i64 v;is >> v;a = Z(v);return is;}friend std::ostream &operator<<(std::ostream &os, const Z &a) {return os << a.val();}
};std::vector<int> rev;
std::vector<Z> roots{0, 1};
void dft(std::vector<Z> &a) {int n = a.size();if (int(rev.size()) != n) {int k = __builtin_ctz(n) - 1;rev.resize(n);for (int i = 0; i < n; i++) {rev[i] = rev[i >> 1] >> 1 | (i & 1) << k;}}for (int i = 0; i < n; i++) {if (rev[i] < i) {std::swap(a[i], a[rev[i]]);}}if (int(roots.size()) < n) {int k = __builtin_ctz(roots.size());roots.resize(n);while ((1 << k) < n) {Z e = power(Z(3), (P - 1) >> (k + 1));for (int i = 1 << (k - 1); i < (1 << k); i++) {roots[2 * i] = roots[i];roots[2 * i + 1] = roots[i] * e;}k++;}}for (int k = 1; k < n; k *= 2) {for (int i = 0; i < n; i += 2 * k) {for (int j = 0; j < k; j++) {Z u = a[i + j];Z v = a[i + j + k] * roots[k + j];a[i + j] = u + v;a[i + j + k] = u - v;}}}
}
void idft(std::vector<Z> &a) {int n = a.size();std::reverse(a.begin() + 1, a.end());dft(a);Z inv = (1 - P) / n;for (int i = 0; i < n; i++) {a[i] *= inv;}
}
struct Poly {std::vector<Z> a;Poly() {}Poly(const std::vector<Z> &a) : a(a) {}Poly(const std::initializer_list<Z> &a) : a(a) {}int size() const {return a.size();}void resize(int n) {a.resize(n);}Z operator[](int idx) const {if (idx < size()) {return a[idx];} else {return 0;}}Z &operator[](int idx) {return a[idx];}Poly mulxk(int k) const {auto b = a;b.insert(b.begin(), k, 0);return Poly(b);}Poly modxk(int k) const {k = std::min(k, size());return Poly(std::vector<Z>(a.begin(), a.begin() + k));}Poly divxk(int k) const {if (size() <= k) {return Poly();}return Poly(std::vector<Z>(a.begin() + k, a.end()));}friend Poly operator+(const Poly &a, const Poly &b) {std::vector<Z> res(std::max(a.size(), b.size()));for (int i = 0; i < int(res.size()); i++) {res[i] = a[i] + b[i];}return Poly(res);}friend Poly operator-(const Poly &a, const Poly &b) {std::vector<Z> res(std::max(a.size(), b.size()));for (int i = 0; i < int(res.size()); i++) {res[i] = a[i] - b[i];}return Poly(res);}friend Poly operator*(Poly a, Poly b) {if (a.size() == 0 || b.size() == 0) {return Poly();}int sz = 1, tot = a.size() + b.size() - 1;while (sz < tot) {sz *= 2;}a.a.resize(sz);b.a.resize(sz);dft(a.a);dft(b.a);for (int i = 0; i < sz; ++i) {a.a[i] = a[i] * b[i];}idft(a.a);a.resize(tot);return a;}friend Poly operator*(Z a, Poly b) {for (int i = 0; i < int(b.size()); i++) {b[i] *= a;}return b;}friend Poly operator*(Poly a, Z b) {for (int i = 0; i < int(a.size()); i++) {a[i] *= b;}return a;}Poly &operator+=(Poly b) {return (*this) = (*this) + b;}Poly &operator-=(Poly b) {return (*this) = (*this) - b;}Poly &operator*=(Poly b) {return (*this) = (*this) * b;}Poly deriv() const {if (a.empty()) {return Poly();}std::vector<Z> res(size() - 1);for (int i = 0; i < size() - 1; ++i) {res[i] = (i + 1) * a[i + 1];}return Poly(res);}Poly integr() const {std::vector<Z> res(size() + 1);for (int i = 0; i < size(); ++i) {res[i + 1] = a[i] / (i + 1);}return Poly(res);}Poly inv(int m) const {Poly x{a[0].inv()};int k = 1;while (k < m) {k *= 2;x = (x * (Poly{2} - modxk(k) * x)).modxk(k);}return x.modxk(m);}Poly log(int m) const {return (deriv() * inv(m)).integr().modxk(m);}Poly exp(int m) const {Poly x{1};int k = 1;while (k < m) {k *= 2;x = (x * (Poly{1} - x.log(k) + modxk(k))).modxk(k);}return x.modxk(m);}Poly pow(int k, int m) const {int i = 0;while (i < size() && a[i].val() == 0) {i++;}if (i == size() || 1LL * i * k >= m) {return Poly(std::vector<Z>(m));}Z v = a[i];auto f = divxk(i) * v.inv();return (f.log(m - i * k) * k).exp(m - i * k).mulxk(i * k) * power(v, k);}Poly sqrt(int m) const {Poly x{1};int k = 1;while (k < m) {k *= 2;x = (x + (modxk(k) * x.inv(k)).modxk(k)) * ((P + 1) / 2);}return x.modxk(m);}Poly mulT(Poly b) const {if (b.size() == 0) {return Poly();}int n = b.size(); // eb + 1std::reverse(b.a.begin(), b.a.end());return ((*this) * b).divxk(n - 1); //保留系数(x ^ eb)及以上的}std::vector<Z> eval(std::vector<Z> x) const {if (size() == 0) {return std::vector<Z>(x.size(), 0);}const int n = std::max(int(x.size()), size());std::vector<Poly> q(4 * n);std::vector<Z> ans(x.size());x.resize(n);std::function<void(int, int, int)> build = [&](int p, int l, int r) {if (r - l == 1) {q[p] = Poly{1, -x[l]};} else {int m = (l + r) / 2;build(2 * p, l, m);build(2 * p + 1, m, r);q[p] = q[2 * p] * q[2 * p + 1];}};build(1, 0, n);std::function<void(int, int, int, const Poly &)> work = [&](int p, int l, int r, const Poly &num) {if (r - l == 1) {if (l < int(ans.size())) {ans[l] = num[0];}} else {int m = (l + r) / 2;work(2 * p, l, m, num.mulT(q[2 * p + 1]).modxk(m - l));work(2 * p + 1, m, r, num.mulT(q[2 * p]).modxk(r - m));}};work(1, 0, n, mulT(q[1].inv(n)));return ans;}
};void solve(){int n, m, k;cin >> n >> m >> k;vector<Z> a(k + 1);a[0] = 1;int R = min(n, k);for(int i = 1;i <= R;i++){a[i] = a[i - 1] * (n - i + 1) / i;}for(int i = 1;i <= R;i+=2){a[i] = 0;}for(int i = 0;i <= R;i+=2){a[i] *= 2;}auto c = Poly(a).pow(m,k + 1);cout << c[k] << "\n";
}

L-Misaka Mikoto’s Dynamic KMP Problem_2023牛客暑期多校训练营7 (nowcoder.com)

思路

注意到|s|>|t|时出现次数必定为0,所以该询问的 x i × y i = 0 x_i×y_i=0 xi×yi=0。而当 ∣ s ∣ ≤ ∣ t ∣ |s| \leq |t| st直接暴力跑KMP求出现次数和最长border即可。单轮复杂度O(t)。

代码

#include <bits/stdc++.h>
using namespace std;
using ll = long long;template<class T>
class KMP {int m;T p;public:vector<int> nxt;KMP() {}KMP(const T &_p) { init(_p); }void init(const T &_p) {m = _p.size() - 1;p = _p;nxt.assign(m + 1, 0);for (int i = 2;i <= m;i++) {nxt[i] = nxt[i - 1];while (nxt[i] && p[i] != p[nxt[i] + 1]) nxt[i] = nxt[nxt[i]];nxt[i] += p[i] == p[nxt[i] + 1];}}vector<int> find(const T &s) {int n = s.size() - 1;vector<int> pos;for (int i = 1, j = 0;i <= n;i++) {while (j && s[i] != p[j + 1]) j = nxt[j];j += s[i] == p[j + 1];if (j == m) {pos.push_back(i - j + 1);j = nxt[j];}}return pos;}vector<int> get_cycle_time() {vector<int> res;int pos = m;while (pos) {pos = nxt[pos];res.push_back(m - pos);}return res;}vector<int> get_cycle_loop() {vector<int> res;for (auto val : get_cycle_time())if (!(m % val)) res.push_back(val);return res;}int min_cycle_loop() { return get_cycle_loop()[0]; }void debug() {for (int i = 1;i <= m;i++)cout << nxt[i] << " \n"[i == m];}
};
/// KMP,前缀函数O(|P|)、查找O(|S|+|P|)、循环相关O(|P|),维护字符串前缀函数int main() {std::ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);int n, q, b, p;cin >> n >> q >> b >> p;vector<int> s(n + 1);for (int i = 1;i <= n;i++) cin >> s[i];ll z = 0;int mul = 1, ans = 0;while (q--) {int op;cin >> op;if (op == 1) {ll x, c;cin >> x >> c;x = (x ^ z) % n + 1;c ^= z;s[x] = c;}else {int m;cin >> m;vector<int> t(m + 1);for (int i = 1;i <= m;i++) {ll val;cin >> val;t[i] = val ^ z;}mul = 1LL * mul * b % p;if (m < n) z = 0;else {KMP<vector<int>> kmp(s);z = 1LL * kmp.nxt[n] * kmp.find(t).size();}ans = (ans + z % p * mul % p) % p;}}cout << ans << '\n';return 0;
}

M-Writing Books_2023牛客暑期多校训练营7 (nowcoder.com)

思路

直接枚举位数。

代码

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fi first
#define sc secondusing namespace std;
const int INF = 0x3f3f3f3f3f3f3f3f;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
typedef pair<int, int> PII;
int n;
int a[N];void solve() {cin >> n;int tmp = 1;int res = 0;int cnt = 1;while (n >= tmp) {int x = tmp;tmp *= 10;res += (min(n, tmp - 1) - x + 1) * cnt;cnt++;}cout << res << "\n";
}signed main() {IOS;int t = 1;cin >> t;for (int i = 1; i <= t; i++) {solve();}
}

相关文章:

2023牛客第七场补题报告C F L M

2023牛客第七场补题报告C F L M C-Beautiful Sequence_2023牛客暑期多校训练营7 (nowcoder.com) 思路 观察到数组一定是递增的&#xff0c;所以从最高位往下考虑每位的1最多只有一个&#xff0c;然后按位枚举贪心即可。 代码 #include <bits/stdc.h> using namespac…...

Android使用kotlin+协程+room数据库的简单应用

前言&#xff1a;一般主线程&#xff08;UI线程&#xff09;中是不能执行创建数据这些操作的&#xff0c;因为等待时间长。所以协程就是为了解决这个问题出现。 第一步&#xff1a;在模块级的build.gradle中引入 id com.android.application// roomid kotlin-androidid kotlin…...

Kubernetes pod调度约束[亲和性 污点] 生命阶段 排障手段

调度约束 Kubernetes 是通过 List-Watch 的机制进行每个组件的协作&#xff0c;保持数据同步的&#xff0c;每个组件之间的设计实现了解耦。 用户是通过 kubectl 根据配置文件&#xff0c;向 APIServer 发送命令&#xff0c;在 Node 节点上面建立 Pod 和 Container。 APIServer…...

Matlab实现模拟退火算法(附上多个完整源码)

模拟退火算法&#xff08;Simulated Annealing&#xff09;是一种全局优化算法&#xff0c;其基本思想是通过模拟物理退火过程来寻找最优解。该算法可以应用于各种优化问题&#xff0c;如函数优化、组合优化、图形优化等。 文章目录 步骤简单案例完整仿真源码下载 步骤 在Mat…...

前后端分离------后端创建笔记(03)前后端对接(上)

本文章转载于【SpringBootVue】全网最简单但实用的前后端分离项目实战笔记 - 前端_大菜007的博客-CSDN博客 仅用于学习和讨论&#xff0c;如有侵权请联系 源码&#xff1a;https://gitee.com/green_vegetables/x-admin-project.git 素材&#xff1a;https://pan.baidu.com/s/…...

stable diffusion安装包和超火使用文档及提示词,数字人网址

一&#xff1a;文生图、图生图 1&#xff1a;stable diffusion&#xff1a;对喜欢二次元、美女小姐姐、大眼萌妹的人及其友好哈哈(o^^o) 1&#xff09;&#xff1a;关于安装包和模型包&#xff1a; 链接&#xff1a;https://pan.baidu.com/s/11_kguofh76gwhTBPUipepw 提取码…...

训练营:贪心篇

贪心就是&#xff1a;局部最优 1、455. 分发饼干 按照饼干分&#xff0c;从大到小&#xff0c;最大的给胃口最大能满足的 def findContentChildren455(g, s):g sorted(g,reverseTrue)s sorted(s,reverseTrue)j0c 0i0while(i<len(s) and j<len(g)):if s[i]>g[j]:c…...

四、Dubbo扩展点加载机制

四、Dubbo扩展点加载机制 4.1 加载机制概述 Dubbo良好的扩展性与框架中针对不同场景使用合适设计模式、加载机制密不可分 Dubbo几乎所有功能组件都是基于扩展机制&#xff08;SPI&#xff09;实现的 Dubbo SPI 没有直接使用 Java SPI&#xff0c;在它思想上进行改进&#xff…...

[保研/考研机试] KY103 2的幂次方 上海交通大学复试上机题 C++实现

题目链接&#xff1a; KY103 2的幂次方 https://www.nowcoder.com/share/jump/437195121691999575955 描述 Every positive number can be presented by the exponential form.For example, 137 2^7 2^3 2^0。 Lets present a^b by the form a(b).Then 137 is present…...

时序预测 | MATLAB实现基于BP神经网络的时间序列预测-递归预测未来(多指标评价)

时序预测 | MATLAB实现基于BP神经网络的时间序列预测-递归预测未来(多指标评价) 目录 时序预测 | MATLAB实现基于BP神经网络的时间序列预测-递归预测未来(多指标评价)预测结果基本介绍程序设计参考资料 预测结果 基本介绍 Matlab实现BP神经网络时间序列预测未来&#xff08;完整…...

组合模式(C++)

定义 将对象组合成树形结构以表示部分-整体’的层次结构。Composite使得用户对单个对象和组合对象的使用具有一致性(稳定)。 应用场景 在软件在某些情况下&#xff0c;客户代码过多地依赖于对象容器复杂的内部实现结构&#xff0c;对象容器内部实现结构(而非抽象接口)的变化…...

git上传问题记录

unable to access ‘https://github.com/songjiahao-wq/untitled.git/’: Failed to connect to github.com port 443 after 21086 ms: Couldn’t connect to serve 解决办法&#xff1a;修改 Git 的网络设置 打开git Bash运行&#xff0c;clash代理一般是下面的端口 # 注意…...

通过动态IP解决网络数据采集问题

动态地址的作用 说到Python网络爬虫&#xff0c;很多人都会遇到困难。最常见的就是爬取过程中IP地址被屏蔽。虽然大部分都是几个小时内自动解封的&#xff0c;但这对于分秒必争的python网络爬虫来说&#xff0c;是一个关键性的打击&#xff01;当一个爬虫被阻塞时&#xff0c;…...

可重入锁,不可重入锁,死锁的多种情况,以及产生的原因,如何解决,synchronized采用的锁策略(渣女圣经)自适应的底层,锁清除,锁粗化,CAS的部分应用

一、&#x1f49b; 锁策略——接上一篇 6.分为可重入锁&#xff0c;不可重入锁 如果一个线程&#xff0c;针对一把锁&#xff0c;连续加锁两次&#xff0c;会出现死锁&#xff0c;就是不可重入锁&#xff0c;不会出现死锁&#xff0c;就是可重入锁。 如果一个线程&#xff0c;针…...

JSON.parse()和JSON.stringify()用法

JSON.parse() 方法用于将 JSON 格式的字符串转换为 JavaScript 对象&#xff0c;而 JSON.stringify() 方法用于将 JavaScript 对象转换为 JSON 字符串。这两个方法可以组合使用来实现将数据从对象到字符串再到对象的转换。 示例 // 创建一个包含属性的 JavaScript 对象 var pe…...

Android 并发编程--阻塞队列和线程池

一、阻塞队列 队列是一种特殊的线性表&#xff0c;特殊之处在于它只允许在表的前端&#xff08;front&#xff09;进行删除操作&#xff0c;而在表的后端&#xff08;rear&#xff09;进行插入操作&#xff0c;和栈一样&#xff0c;队列是一种操作受限制的线性表。进行插入操作…...

Playwright快速上手-1

前言 随着近年来对UI自动化测试的要求越来越高&#xff0c;,功能强大的测试框架也不断的涌现。本系列主讲的Playwright作为一款新兴的端到端测试框架,凭借其独特优势,正在逐渐成为测试工程师的热门选择。 本系列文章将着重通过示例讲解 Playwright python开发环境的搭建 …...

PPT颜色又丑又乱怎么办?

一、设计一套PPT时&#xff0c;可以从这5个方面进行设计 二、PPT颜色 &#xff08;一&#xff09;、PPT常用颜色分类 一个ppt需要主色、辅助色、字体色、背景色即可。 &#xff08;二&#xff09;、搭建PPT色彩系统 设计ppt时&#xff0c;根据如下几个步骤&#xff0c;依次选…...

python计算相关系数R

方法一&#xff1a; import numpy as np# 计算相关系数R def r(y_true, y_pred):y_true np.array(y_true)y_pred np.array(y_pred)corr np.corrcoef(y_true, y_pred)[0][1]return corrcorr r(yture, ypred)方法二 import scipy.stats # 计算皮尔逊相关指数&#xff0c;并…...

黑马项目一阶段面试 自我介绍篇

面试官你好&#xff0c;我叫xxx&#xff0c;是来自xxxx的本科毕业生。我通过招聘网站/内推/线下招聘了解到的贵司&#xff0c;我具有扎实的Java后端的基础功底&#xff0c;基本掌握JavaSE、JavaEE流行技术的使用&#xff0c;并且我比较好学&#xff0c;心态也很乐观积极&#x…...

智慧医疗能源事业线深度画像分析(上)

引言 医疗行业作为现代社会的关键基础设施,其能源消耗与环境影响正日益受到关注。随着全球"双碳"目标的推进和可持续发展理念的深入,智慧医疗能源事业线应运而生,致力于通过创新技术与管理方案,重构医疗领域的能源使用模式。这一事业线融合了能源管理、可持续发…...

R语言AI模型部署方案:精准离线运行详解

R语言AI模型部署方案:精准离线运行详解 一、项目概述 本文将构建一个完整的R语言AI部署解决方案,实现鸢尾花分类模型的训练、保存、离线部署和预测功能。核心特点: 100%离线运行能力自包含环境依赖生产级错误处理跨平台兼容性模型版本管理# 文件结构说明 Iris_AI_Deployme…...

多场景 OkHttpClient 管理器 - Android 网络通信解决方案

下面是一个完整的 Android 实现&#xff0c;展示如何创建和管理多个 OkHttpClient 实例&#xff0c;分别用于长连接、普通 HTTP 请求和文件下载场景。 <?xml version"1.0" encoding"utf-8"?> <LinearLayout xmlns:android"http://schemas…...

微信小程序 - 手机震动

一、界面 <button type"primary" bindtap"shortVibrate">短震动</button> <button type"primary" bindtap"longVibrate">长震动</button> 二、js逻辑代码 注&#xff1a;文档 https://developers.weixin.qq…...

MODBUS TCP转CANopen 技术赋能高效协同作业

在现代工业自动化领域&#xff0c;MODBUS TCP和CANopen两种通讯协议因其稳定性和高效性被广泛应用于各种设备和系统中。而随着科技的不断进步&#xff0c;这两种通讯协议也正在被逐步融合&#xff0c;形成了一种新型的通讯方式——开疆智能MODBUS TCP转CANopen网关KJ-TCPC-CANP…...

Spring Cloud Gateway 中自定义验证码接口返回 404 的排查与解决

Spring Cloud Gateway 中自定义验证码接口返回 404 的排查与解决 问题背景 在一个基于 Spring Cloud Gateway WebFlux 构建的微服务项目中&#xff0c;新增了一个本地验证码接口 /code&#xff0c;使用函数式路由&#xff08;RouterFunction&#xff09;和 Hutool 的 Circle…...

LeetCode - 199. 二叉树的右视图

题目 199. 二叉树的右视图 - 力扣&#xff08;LeetCode&#xff09; 思路 右视图是指从树的右侧看&#xff0c;对于每一层&#xff0c;只能看到该层最右边的节点。实现思路是&#xff1a; 使用深度优先搜索(DFS)按照"根-右-左"的顺序遍历树记录每个节点的深度对于…...

安全突围:重塑内生安全体系:齐向东在2025年BCS大会的演讲

文章目录 前言第一部分&#xff1a;体系力量是突围之钥第一重困境是体系思想落地不畅。第二重困境是大小体系融合瓶颈。第三重困境是“小体系”运营梗阻。 第二部分&#xff1a;体系矛盾是突围之障一是数据孤岛的障碍。二是投入不足的障碍。三是新旧兼容难的障碍。 第三部分&am…...

华为OD机试-最短木板长度-二分法(A卷,100分)

此题是一个最大化最小值的典型例题&#xff0c; 因为搜索范围是有界的&#xff0c;上界最大木板长度补充的全部木料长度&#xff0c;下界最小木板长度&#xff1b; 即left0,right10^6; 我们可以设置一个候选值x(mid)&#xff0c;将木板的长度全部都补充到x&#xff0c;如果成功…...

离线语音识别方案分析

随着人工智能技术的不断发展&#xff0c;语音识别技术也得到了广泛的应用&#xff0c;从智能家居到车载系统&#xff0c;语音识别正在改变我们与设备的交互方式。尤其是离线语音识别&#xff0c;由于其在没有网络连接的情况下仍然能提供稳定、准确的语音处理能力&#xff0c;广…...