摘要:
1、__builtin_popcount 的使用 1.1 1的数量 #include <bits/stdc++.h> using namespace std; using i64 = long long; void solve() { int x; cin >> x; int t = __built 阅读全文
摘要:
167. 两数之和Ⅱ-输入有序数组 class Solution { public: vector<int> twoSum(vector<int>& numbers, int target) { vector<int> ans; int n = numbers.size(); int l = 0, 阅读全文
摘要:
D - Unbalanced 只需要找到形如 \(XX\)、\(XYX\) 的字串即可。即两个相同字符之间最多间隔一个字符。 证明:若不然,\(AXYA\),每加一个字符 \(A\),都要增加多余字符 \(XY\),不可能符合要求。 #include <bits/stdc++.h> using na 阅读全文
摘要:
A - Subsegment Reverse #include <bits/stdc++.h> using namespace std; using i64 = long long; int main() { ios::sync_with_stdio(false), cin.tie(nullptr) 阅读全文