自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(5)
  • 收藏
  • 关注

原创 树状数组关键函数和简单应用

树状数组简单来说,是一个一维数组,但是可以动态查询前缀和(query()),和在某一个位置上加上一个数(add()),并且两个操作的时间复杂度都是logn。#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>using namespace std;const int N = 100010;int tre[N];//树状数组下标必须从1开始int n;

2020-10-02 21:40:53 162

原创 C++将一行以空格为分隔符的数据读入数组

C++ 把一行带有空格的数据依次读入数组#include<iostream>#include<sstream>using namespace std;int main(){ int a[10]; int n = 0; string line; getline(cin,line); stringstream ssin(line); while (ssin >

2020-09-21 10:23:05 4005

原创 去掉vector中重复的元素

去掉vector中重复的元素visual studio 环境#include<iostream>#include<algorithm>#include<vector>using namespace std;const int N = 200010;vector<int> a;int main(){ a.push_back(1); a.push_back(2); a.push_back(3);

2020-09-21 10:13:55 191

原创 C++ 归并排序(visual studio 环境)

C++ 归并排序visual studio 环境one函数可用于求逆序对#include<iostream>using namespace std;const int N = 500010;int s[N],b[N];long long countm;void one(int a[], int p, int q, int mid){ int i = p, j = mid + 1; for (int k = p; k <= q; k++)

2020-09-21 10:07:20 115

原创 C++ 快速排序 (visual studio环境)

C++ 快速排序 (visual studio环境)// An highlighted block#include<iostream>using namespace std;int sort1(int a[],int p,int q){ int x = a[p],i=p+1,temp; if (p < q) { for (int j = p + 1; j <= q; j++) { if (a[j

2020-09-21 09:55:19 288

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除