摘要:
7-1 100...07是不是素数? 每个数暴力 \(O(\sqrt{v})\) 找最小质因子即可,时间复杂度 \(O(n\cdot \sqrt{v})\) #include <bits/stdc++.h> using namespace std; using ll = long long; int 阅读全文
摘要:
洛谷题解 A 集合写真 题目描述 有\(N\)个人从矮到高排列,这时候又来了一个人,请你确定这个人的位置。 思路 考察STL基本函数的运用 直接用用upper_bound或者lower_bound直接查询位置输出就行了。 参考代码 #include <bits/stdc++.h> using nam 阅读全文
摘要:
洛谷题解 A 不知道为什么题目挂了, 直接求前缀和板子题, 这题甚至不用开 ll #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii 阅读全文
摘要:
题目:CF2154B 2154B 题目中有这样一句话: 操作1: 选择一个整数 i 并执行 : 用最大值为 i的前缀替换 $ a_i $ 。 关键区别:“最大值”的计算方式 第一段代码(逐步更新最大值): for (int i = 0, max = 0; i < n; ++ i) { max = s 阅读全文