基础算法(排序,二分,高精度,前缀和,差分,双指针,位运算,离散化,区间合并)

news/2024/4/26 18:56:19/文章来源:https://blog.csdn.net/weixin_64632836/article/details/128948150

基础算法

目录

    • 基础算法
      • 排序
        • 快速排序
          • 步骤(分治)
        • 归并排序
          • **步骤(分治)**:
      • 二分
          • 代码
      • 高精度
        • A + B
        • A - B
        • A * b
        • A /b
      • 前缀和
        • 一维数组
        • 二维数组
      • 差分(前缀和逆运算)
        • 一维构造
        • 二维差分
      • 双指针
      • 位运算
        • lowbit(x)
      • 离散化(整数)
        • 核心代码
      • 区间合并(贪心)

排序

快速排序

步骤(分治)
  • 确定分界点x(左右边界点或中间的点)
  • 调整区间:使得第一个区间所有元素小于等于x,第二区间所有元素大于x

方法:双指针

左指针右移直到元素大于x, 右指针相反,然后交换左右指针的值

  • 递归处理左右两端

代码这样写(第一个元素为分界点):

#include<iostream>
using namespace std;void print(int a[], int n)
{  for(int j= 0; j<n; j++){  cout<<a[j] <<"  ";  }  cout<<endl;  
}  void quickSort(int a[], int low ,int high)
{if(low<high)  {int i = low, j = high;  int x = a[low];                                      while(i<j)  {while(i<j && a[j] >= x) j--;  if(i<j) a[i++] = a[j];   while(i<j && a[i] <= x) i++;if(i<j) a[j--] = a[i];  } a[i] = x; quickSort(a, i+1 ,high);}
}int main()
{  int a[10] = {8,1,9,7,2,4,5,6,10,3};  cout<<"初始序列:";  print(a,10);  quickSort(a,0,9);  cout<<"排序结果:";  print(a,10);  return
} 

一般我们更常用下面的代码(左边小于等于x, 右边大于等于x)

#include<iostream>
using namespace std;
const int N = 1e6 + 10;int n;
int q[N];void quick_sort(int q[], int l, int r) {if (l >= r)	return;int x = q[l], i = l - 1, j = r + 1;while (i < j) {while (q[++i] < x);while (q[--j] > x);cout << q[i] << " " << q[j]<<endl;if (i < j)	swap(q[i], q[j]);for (int i = 0; i < n; ++i) {cout << q[i] << " " ;}cout << endl;}quick_sort(q, l, j);quick_sort(q, j + 1, r);
}int main() {cin >> n;for (int i = 0; i < n; ++i) {cin >> q[i];}quick_sort(q, 0, n - 1);for (int i = 0; i < n; ++i) {cout << q[i] << " ";}return 0;
}

归并排序

O(nlogn)

稳定:两个相同值排序后的相对位置不发生变化(快速排序不稳定)

步骤(分治)
  • 确定分界点, 中间的点
  • 递归排序left,right
  • 归并,合二为一

代码

#include <iostream>
using namespace std;const int N = 1e6 + 10;
int n;
int q[N], tmp[N];void merge_sort(int arr[], int l, int r) {if (l >= r)     return;int mid = (l + r) / 2;merge_sort(arr, l, mid), merge_sort(arr, mid + 1, r);int i = l, j = mid + 1, k = 0;while (i <= mid && j <= r) {if (q[i] <= q[j])       tmp[k++] = q[i++];else    tmp[k++] = q[j++];    // cout << tmp[k-1] <<" "<<l<<" "<<r << endl;}while (i <= mid)    tmp[k++] = q[i++];while (j <= r)      tmp[k++] = q[j++];for (int m = 0; m < k; ++m) {q[l + m] = tmp[m];} // for (int i = 0; i < n; ++i) {//     cout << q[i] << " ";// } cout << endl;
}int main() {cin >> n;for (int i = 0; i < n; ++i) {cin >> q[i];}merge_sort(q, 0, n - 1);for (int i = 0; i < n; ++i) {cout << q[i] << " ";}
}

二分

(很容易死循环 TuT)

在一个区间:右半边满足某性质,左半边不满足,可以用二分来找到边界点

代码
class Solution {
public:int search(vector<int>& nums, int target) {int l = 0, r = nums.size() - 1;while (l <= r) {int mid = l + r >> 1;if (nums[mid] < target) l = mid + 1;else if (nums[mid] > target)   r = mid - 1;else    return mid; }return -1;}
};

样例

给定一个按照升序排列的长度为 nn 的整数数组,以及 qq 个查询。

对于每个查询,返回一个元素 kk 的起始位置和终止位置(位置从 00 开始计数)。

如果数组中不存在该元素,则返回 -1 -1

输入格式

第一行包含整数 nn 和 qq,表示数组长度和询问个数。

第二行包含 nn 个整数(均在 1∼100001∼10000 范围内),表示完整数组。

接下来 qq 行,每行包含一个整数 kk,表示一个询问元素。

输出格式

共 qq 行,每行包含两个整数,表示所求元素的起始位置和终止位置。

如果数组中不存在该元素,则返回 -1 -1

代码

#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int ar[N];
int main() {int n, m;cin >> n >> m;for (int i = 0; i < n; ++i)     cin >> ar[i];while (m--) {int x;cin >> x;int l = 0, r = n - 1;while (l < r) {int mid = (l + r) >> 1;if (ar[mid] >= x)   r = mid;else    l = mid + 1;}// cout << l;if (ar[l] != x) {cout << "-1 -1" << endl;continue;}int ans1 = l;l = 0, r = n - 1;while (l < r){int mid = (l + r + 1) >> 1; // 防止死循环if (ar[mid] <= x)   l = mid;else    r = mid - 1; }int ans2 = l;cout << ans1 << " " << ans2 << endl; }return 0;
}

高精度

  • 大整数存储:存在一个数组中,下标为零存个位

A + B

#include <iostream>
#include <vector>
using namespace std;
vector<int> a, b;
vector<int> add(vector<int> &a, vector<int> &b) {vector<int> ans;int t = 0;for (int i = 0; i < a.size() || i < b.size(); ++i) {if (i < a.size())   t += a[i];  if (i < b.size())   t += b[i];ans.push_back(t % 10);t /= 10;}if (t)  ans.push_back(t);//cout << ans.size() << endl;return ans;
}
int main() {string x, y;cin >> x >> y;for (int i = x.size() - 1; i  >= 0; --i)      a.push_back(x[i] - '0');for (int i = y.size() - 1; i  >= 0; --i)      b.push_back(y[i] - '0');vector<int> ans = add(a, b);for (int i = ans.size() - 1; i >= 0; --i)    cout <<ans[i];return 0; 
}

A - B

#include <iostream>
#include <vector>
using namespace std;
bool cmp (vector<int> &a, vector<int> &b) {if (a.size() != b.size())   return a.size() > b.size();for (int i = a.size() - 1; i >= 0; --i) {if (a[i] != b[i])    return a[i] > b[i];}return true;
}
vector<int> minuss(vector<int> a, vector<int> b) {vector<int> ans;int t = 0;for (int i = 0; i < a.size(); ++i) {t += a[i];if (i < b.size())   t -= b[i];//if (t >= 0) {ans.push_back(t);t = 0;}     else {ans.push_back(10 + t);t = -1;}//cout << ans.size() << endl;}
//    for (int i = ans.size() - 1; i >= 0; --i) {
//        cout << ans[i];
//    }for (int i = ans.size() - 1; i >= 1; --i) {if (ans[i] == 0)    ans.pop_back();else    break;}return ans;
}
int main() {string a, b;cin >> a >> b;vector<int> aa, bb;for (int i = a.size() - 1; i >= 0; --i) {aa.push_back(a[i] - '0');}for (int i = b.size() - 1; i >= 0; --i) {bb.push_back(b[i] - '0');}vector<int> ans;if (!cmp(aa, bb)) {cout << "-";ans = minuss(bb, aa); }  else	 ans = minuss(aa, bb);//cout<<ans.size();for (int i = ans.size() - 1; i >= 0; --i) {cout << ans[i];}return 0;
}

A * b

  • 高精度整数A乘低精度整数b
#include <iostream>
#include <vector>
using namespace std;
vector <int> mul(vector<int> a, int b) {vector<int> ans;int t = 0;for (int i = 0; i < a.size(); ++i) {t += a[i] * b;ans.push_back(t % 10);t /= 10; }if (t)  ans.push_back(t);while (ans.size() > 1 && ans.back() == 0) ans.pop_back();//cout << t << endl; return ans;
}
int main() {string a;int b;vector<int> A;cin >> a >> b;for (int i = a.size() - 1; i >= 0; --i)     A.push_back(a[i] - '0');auto ans = mul(A, b);for (int i = ans.size() - 1; i >= 0; --i) {cout << ans[i];}return 0;
}

A /b

  • 高精度整数A除低精度整数b
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> div(vector<int> &a, int b, int &r) {r = 0;vector<int> c;for (int i = a.size() - 1; i >= 0; --i) {r = r * 10 + a[i];c.push_back(r / b);r %= b;}reverse(c.begin(), c.end());while (c.size() > 1 && !c.back())   c.pop_back();return c;
}int main() {string a;int b, r;cin >> a >> b;vector <int> A;for (int i = a.size() - 1; i >= 0; --i) {A.push_back(a[i] - '0');}auto ans = div(A, b, r);for (int i = ans.size() - 1; i >= 0; --i) {cout << ans[i];}cout << endl;cout << r;return 0;
}

前缀和

一维数组

Si=a1+a2+...+aiS_i = a_1 + a_2 +...+ a_i Si=a1+a2+...+ai

ai=si−si−1a_i = s_i -s_{i-1} ai=sisi1

  • 定义s0s_0s0为0
  • 作用:一次运算求出一段区间的和([l, r] : srs_rsr - si−1s_{i-1}si1)

代码

#include <iostream>
#include <vector>
using namespace std;
int main() {int m, n;cin >> n >> m;vector<int> a(n + 1);vector<int> s(n + 1);for (int i = 1; i <=n; ++i) {cin >> a[i];s[i] = s[i-1] + a[i];}while (m--) {int l, r;cin >> l >> r;cout << s[r] - s[l - 1] << endl;}return 0;
}

二维数组

Si,j=Si−1,j+Si,j−1−Si−1,j−1+ai,jS_{i,j} = S_{i-1,j}+S_{i,j-1}-S_{i-1,j-1}+a_{i,j} Si,j=Si1,j+Si,j1Si1,j1+ai,j

aij到sija_{ij}到s_{ij}aijsij
Sx2y2−Sx2y1−Sx1y2+Sx1y1S_{x_2y_2}-S_{x_2y_1}-S_{x_1y_2} + S{x_1y_1} Sx2y2Sx2y1Sx1y2+Sx1y1
代码

#include <iostream>
using namespace std;
const int N = 1010;
int m, n, q;
int a[N][N], s[N][N];
int main() {ios::sync_with_stdio(false);cin >> n >> m >> q;for (int i = 1; i <= n; ++i) {for (int j = 1; j <= m; ++j) {cin >> a[i][j];s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i-1][j-1] + a[i][j];}}while (q--) {int x1, y1, x2, y2;cin >> x1 >> y1 >> x2 >> y2;cout << s[x2][y2] - s[x2][y1-1] - s[x1-1][y2] + s[x1-1][y1-1] << endl;}return 0;
}

差分(前缀和逆运算)

一维构造

已知a1,a2,...,ana_1,a_2,...,a_na1,a2,...,an

构造b1,b2,...,bnb_1,b_2,...,b_nb1,b2,...,bn

使得ai=b1+b2+...+bia_i=b_1+b_2+...+b_iai=b1+b2+...+bi

我们可以通过b 数组得到a 数组

  • a数组[l, r] + c :bl+cb_l+cbl+cbr+1−cb_{r+1}-cbr+1c

代码

#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int s[N], d[N];
int main() {ios::sync_with_stdio(false);int n, m;cin >> n >> m;for (int i = 1; i <= n; ++i)  {cin >> s[i];d[i] = s[i] - s[i - 1];}while (m--) {int l, r, c;cin >> l >> r >> c;d[l] += c;d[r + 1] -= c;}for (int i = 1; i <= n; ++i) {s[i] = s[i - 1] + d[i];cout << s[i] << " ";}return 0;
}
#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int a[N], b[N];
void insert(int l, int r, int c) {b[l] += c;b[r + 1] -= c;
}
int main() {ios::sync_with_stdio(false);int n, m;cin >> n >> m;for (int i = 1; i <= n; ++i) {cin >> a[i];insert(i, i, a[i]);}while (m--) {int l, r, c;cin >> l >> r >> c;insert(l, r, c);}for (int i = 1; i <= n; ++i) {a[i] = a[i-1] + b[i];cout << a[i] << " ";}return 0;
}

二维差分

代码

注意insert函数

#include <iostream>
using namespace std;
const int N = 1010;
int a[N][N], b[N][N];
void insert(int x1, int y1, int x2, int y2, int c) {b[x1][y1] += c;b[x1][y2+1] -= c;b[x2+1][y1] -= c;b[x2+1][y2+1] += c;
}
int main() {ios::sync_with_stdio(false);int m, n, q;cin >> n >> m >> q;for (int i = 1; i <= n; ++i) {for (int j = 1; j <= m; ++j) {cin >> a[i][j];insert(i, j, i, j, a[i][j]);}}while (q--) {int x1, x2, y1, y2, c;cin >> x1 >> y1 >> x2 >> y2 >> c;insert(x1, y1, x2, y2, c);}for (int i = 1; i <= n; ++i) {for (int j = 1; j <= m; ++j) {a[i][j] = a[i-1][j] + a[i][j-1] - a[i-1][j-1] + b[i][j];cout << a[i][j] << " ";}cout << endl;}return 0;
}
#include <iostream>
using namespace std;
const int N = 1010;
int a[N][N], b[N][N];
void insert(int x1, int y1, int x2, int y2, int c) {b[x1][y1] += c;b[x1][y2+1] -= c;b[x2+1][y1] -= c;b[x2+1][y2+1] += c;
}
int main() {ios::sync_with_stdio(false);int m, n, q;cin >> n >> m >> q;for (int i = 1; i <= n; ++i) {for (int j = 1; j <= m; ++j) {cin >> a[i][j];insert(i, j, i, j, a[i][j]);}}while (q--) {int x1, x2, y1, y2, c;cin >> x1 >> y1 >> x2 >> y2 >> c;insert(x1, y1, x2, y2, c);}for (int i = 1; i <= n; ++i) {for (int j = 1; j <= m; ++j) {b[i][j] += b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1];cout << b[i][j] << " ";}cout << endl;}return 0;
}

双指针

快慢指针

给定一个长度为 n 的整数序列,请找出最长的不包含重复的数的连续区间,输出它的长度。

#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int a[N], s[N];
int main() {ios::sync_with_stdio(false);int n;cin >> n;for (int i = 0; i < n; ++i) {cin >> a[i];}int res = 0;for (int i = 0, j = 0; i < n; ++i) {++s[a[i]];while (j < i && s[a[i]] > 1)    --s[a[j++]];res = max(res, i - j + 1);} cout << res;return 0;
}

位运算

n的二进制第k位是几: n >> k & 1

lowbit(x)

返回x最后一个1以及后面部分

int lowbit(int x) {return x & -x;
}

代码

#include <iostream>
using namespace std;int lowbit(int x) {return x & -x;
}int main() {int n;cin >> n;while (n--) {int x;cin >> x;int ans = 0;while (x) {x -= lowbit(x);++ans;}cout << ans << " ";}return 0;
}

x = 1010

原码 0…01010

反码 1…11010

补码(取反加一)11…11011

计算机负数用补码表示

离散化(整数)

  • 10510^5105个数,值域0−1090-10^90109(个数比较少。数值比较大)
  • 我们需要把值作为下标

我们把他们映射到1,2,3,4,5…自然数

核心代码

int find(int x) {int l = 0, r = alls.size() - 1;while (l < r) {int mid = l + r >> 1;if (alls[mid] >= x)     r = mid;else    l = mid + 1;}return r;
}
    sort(alls.begin(), alls.end());// 去重alls.erase(unique(alls.begin(), alls.end()), alls.end());

代码

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 3e5 + 10;
int a[N], s[N];
vector<int> alls;
vector<pair<int, int>> add, query;
int find(int x) {int l = 0, r = alls.size() - 1;while (l < r) {int mid = l + r >> 1;if (alls[mid] >= x)     r = mid;else    l = mid + 1;}return r;
}
int main() {int n, m;cin >> n >> m;while (n--) {int x, c;cin >> x >> c;add.push_back({x, c});alls.push_back(x);}while (m--) {int l, r;cin >> l >> r;query.push_back({l,  r});alls.push_back(l);alls.push_back(r);}sort(alls.begin(), alls.end());// 去重alls.erase(unique(alls.begin(), alls.end()), alls.end());for (auto i: add) {// a数组从1开始计int x = find(i.first) + 1;a[x] += i.second; }//  前缀和数组for (int i = 1; i <= alls.size(); ++i) {s[i] = s[i-1] + a[i];}for (auto i: query) {int  l = find(i.first) + 1, r = find(i.second) + 1;cout << s[r] - s[l-1] << endl;}return 0;
}

区间合并(贪心)

  • 按区间左端点排序
  • 右端点合并

代码

#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#define ll long long
using namespace std;vector<pair<int, int>> merge(vector<pair<int, int>> &p) {vector<pair<int, int>> ans;sort(p.begin(), p.end());int st = -2e9, ed = -2e9;for (auto i: p) {if (i.first > ed) {if (st != -2e9)  ans.push_back({st, ed});st = i.first, ed = i.second;}else {ed = max(ed, i.second);}}if (st != -2e9)  ans.push_back({st, ed});return ans;
}
int main()
{vector<pair<int, int>> segs;int n;cin >> n;while (n--) {int l, r;cin >> l >> r;segs.push_back({l, r});} auto ans = merge(segs);cout << ans.size();return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_255740.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

卸载Node.js

0 写在前面 无论您是因为什么原因要卸载Node.js都必须要卸载干净。 请阅读&#xff1a; 1 卸载步骤 1.1通过控制面板卸载node.js winR—>control.exe—>卸载程序—>卸载Node.js 等待—>卸载成功 1.2 删除安装时的nodejs文件夹 通过记忆或者Everthing搜索找…

「自控元件及线路」14 电子电力技术与功率放大器概述

本节介绍电子电力技术的基本概念 本节介绍PD、SCR、GTR、MOSFET、IGBT等电子电力器件 本节介绍功率放大器的基本概念和线性功率放大器 文章目录电力电子技术概述电能变换电子电力器件功率二极管PD晶闸管SCR功率晶体管GTR功率场效应晶体管PowerMOSFET绝缘栅双极晶体管IGBT功率放…

使用 ThreeJS 实现第一个三维场景(详)

文章目录参考描述index.html三维场景的基本实现导入 ThreeJS准备工作场景摄像机视锥体正交摄像机透视摄像机渲染器后续处理将摄像机添加至场景中移动摄像机设置画布尺寸将渲染器创建的画布添加到 HTML 元素中渲染物体结构材质合成将物体添加至场景中代码总汇执行效果动画reques…

你的自动化框架如何设计的?为什么感觉面试官总是不满意,到底问题出在哪?

前言去面试自动化测试岗位&#xff0c;尤其是接口自动化岗位&#xff0c;面试官总会问&#xff1a;说下你的自动化框架如何设计的&#xff1f;为什么回答后&#xff0c;面试官对你的框架设计总是感觉不满意&#xff1f;自动化测试实现的几种方式对于不同的公司来说&#xff0c;…

2023年地方两会政府工作报告汇总(各省市23年重点工作)

新年伊始&#xff0c;全国各地两会密集召开&#xff0c;各省、市、自治区2023年政府工作报告相继出炉&#xff0c;各地经济增长预期目标均已明确。相较于2022年&#xff0c;多地经济增长目标放缓&#xff0c;经济不断向“高质量”发展优化转型。今年是二十大后的开局之年&#…

【参加CUDA线上训练营】零基础cuda,一文认识cuda基本概念

【参加CUDA线上训练营】零基础cuda,一文认识cuda基本概念1.术语2.线程层次2.1 Block、Warp与Thread之间的关系2.2 Thread index1.术语 \\%序号名称描述1HostCPU和内存&#xff08;host memory&#xff09;2DeviceGPU和显存&#xff08;device memory&#xff09;3SMStreaming M…

101-并发编程详解(上篇)

并发编程详解在学习之前&#xff0c;如果多线程的理解足够&#xff0c;可以往下学习&#xff0c;否则的话&#xff0c;建议先看看26章博客&#xff08;只是建议&#xff09;&#xff0c;注意&#xff1a;可能有些字的字体不对&#xff0c;那么一般是复制粘贴来的&#xff0c;但…

开关电源-一种方便快捷计算开关电源环路参数的方法及实例

一种方便快捷计算开关电源环路参数的方法及实例 接上文《技术实例 | 开关电源环路测量时&#xff0c;注入信号的幅值对测量结果的影响》&#xff0c;得到电流环功率级的开环传递函数后&#xff0c;我们通过matlab的sisotool工具箱自动计算出了电流环路补偿器的传递函数C&#…

三层交换机【实验】

目录 1、要求&#xff1a; 2、拓扑&#xff1a; 3、创建vlan和端口定义并划入vlan&#xff1a; 4、创建以太网中继Eth-Trunk使sw1和sw2的相互冗余并且不浪费链路&#xff1a; 5、使用mstp定义组和对应的根&#xff1a; 6、配置网关冗余&#xff1a; 7、核心层的路由的IP配…

云仓仓储的运行模式是什么?

仓库能够简单地定义为一个规划空间&#xff0c;通常是一个用于处置和贮存货物的大型商业建筑。因而&#xff0c;仓储是指在这样一个规划空间中存储和处置货物所触及的一切过程。仓库中常见的货物包括&#xff1a;;机械零配件、建筑资料、废品农产品、家具和电子产品。仓库中的一…

Fluid-数据缓存亲和性调度原理解析

前言在Fluid中&#xff0c;Dataset资源对象中所定义的远程文件是可被调度的&#xff0c;这意味着你能够像管理你的Pod一样管理远程文件缓存在Kubernetes集群上的存放位置。另外&#xff0c;Fluid同样支持对于应用的数据缓存亲和性调度&#xff0c;这种调度方式将应用(e.g. 数据…

二进制部署K8S集群

目录 一、架构图 二、部署步骤 1、实验环境 2、操作系统初始化配置 3、部署 docker引擎 4、部署 etcd 集群 5、部署 Master 组件 一、架构图 二、部署步骤 1、实验环境 服务器类型IP地址master192.168.80.5node01192.168.80.8node02192.168.80.9 2、操作系统初始化配置…

SpringBoot整合Mybatis的核心原理

0. 前言&#xff1a;1. 自动配置类MybatisAutoConfiguration&#xff1a;1.1. SqlSessionFactory的生成&#xff1a;1.2. Mapper的扫描和代理生成&#xff1a;1.2.1. MapperScannerConfigurer1.2.2. MapperFactoryBean1.2.3. getMapper生成代理对象2. 小结&#xff1a;0. 前言&…

3D模型深度生成网络【ShapeAssembly】

推荐&#xff1a;使用 NSDT场景设计器 快速搭建 3D场景。 我们提出了一个深度生成模型&#xff0c;该模型学习在ShapeAssembly中编写新颖的程序&#xff0c;ShapeAssembly是一种用于建模3D形状结构的特定领域语言。 执行 ShapeAssembly 程序会生成一个由部件代理长方体的分层连…

2023,考个软考中级证书稳妥深圳入户,5月考试8月办入户

最新消息&#xff01;最新消息&#xff01;最新消息&#xff01; 2023年2月8日&#xff0c;深圳市发展和改革委员会深圳市公安局深圳市人力资源和社会保障局关于印发《深圳市积分入户办法》的最新通知↓ 来源《深圳市发展和改革委员会》 该积分入户将于2023年2月15日正式实施&…

Prometheus监控Java-JMX

一、什么是 JMX Exporter ? JMX Exporter 利用 Java 的 JMX 机制来读取 JVM 运行时的一些监控数据&#xff0c;然后将其转换为 Prometheus 所认知的 metrics 格式&#xff0c;以便让 Prometheus 对其进行监控采集。 那么&#xff0c;JMX 又是什么呢&#xff1f;它的全称是&a…

ChatGPT 支持的搜索引擎 Bing 究竟什么样?

微软于2月8日北京时间凌晨在 Redmond 线下举办一场媒体活动&#xff0c;围绕微软的产品以及 AI&#xff0c;公布最新消息。这里我们先回顾一下微软在 AI 上的布局。 2019年&#xff0c;微软向 OpenAI 投资10亿美元&#xff0c;成为了 OpenAI 紧密的合作伙伴&#xff0c;而微软…

Java中动态调用setter以及getter

0x00 前言 对于非专业程序员的安全人员来说&#xff0c;因为没有代码项目的积累&#xff0c;很多知识体系都不完善&#xff0c;所以有必要在一些常用的内容进行学习的总结。 在很多的调用链中都会用到**“动态调用setter以及getter”**这个知识点&#xff0c;比如经典的CB链&a…

Python语言零基础入门教程(九)

Python pass 语句 Python pass 是空语句&#xff0c;是为了保持程序结构的完整性。 pass 不做任何事情&#xff0c;一般用做占位语句。 Python 语言 pass 语句语法格式如下&#xff1a; pass测试实例&#xff1a; #!/usr/bin/python # -*- coding: UTF-8 -*- # 输出 Pytho…

线程池小结

什么是线程池 线程池其实就是一种多线程处理形式&#xff0c;处理过程中可以将任务添加到队列中&#xff0c;然后在创建线程后自动启动这些任务。这里的线程就是我们前面学过的线程,这里的任务就是我们前面学过的实现了Runnable或Callable接口的实例对象; 为什么使用线程池 …