自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 vector 和deque

vector程序示例 #include<iostream> #include<vector> using namespace std; template<class T> void print(T s,T e){ for(;s!=e;++s) cout<<*s<<" "; cout<<endl; } int main()...

2019-09-24 11:31:52 314

原创 没写完

容器概述 可以用于存放各种类型的数据(基本类型的变量,对象等)的数据结构,都是类模板,分为3种: 1 顺序容器 vector(动态数组) deque(双向队列) list (双向链表) 2 关联容器 set multiset map multimap 3 容器适配器 stack(栈) queue(队列) priority_queue(优先队列) 顺序容器简介 容器并非排序的,元...

2019-09-21 20:47:37 198

原创 string类函数

string类程序样例 string s1(“hello”); cout<<s1; //输出hello string s2(8,‘x’); cout<<s2; //输出xxxxxxxx string month = “march”; cout<<moth<<endl; //输出march string s; s=‘n’; cout<<s&...

2019-09-21 14:24:09 264

原创 乱七八糟

二分模板 无精度: while(l<=r){ int mid=(l+r)/2; if(check(mid)){ res=mid; r=mid-1; } else l=mid+1; } 要求精度 const double eps=1e-7; double l,r; while(1+eps<r){ double mid=(l+r)/2.0; if(check(mid)) l=mid; el...

2019-08-31 09:37:27 150

原创 线段树,树状数组 模板

线段树: 一:建树//开始建树的时候为built(1,1,n) void built(int rt int l,int r)//rt为结点,初始值为1,l,r分别为左右端点 { tree[rt].l=l; tree[rt].r=r; if(l == r) tree[rt].sum = a[l]; return ; int mid = (l+r)>>1;//右移一位相当于除以2 bu...

2019-08-16 14:37:26 204 1

原创 AcWing 89. a^b

//11写成二进制为1011,11=23+21+2^0 //a11=a(23+21+2^0) #include #include #include #include using namespace std; #define ll long long ll n,m,k; ll power(ll n,ll m,ll k) { ll ans=1%k; while(m) { if (m&1...

2019-08-13 19:36:30 202

原创 模板

线性筛法打表素数 欧拉函数 gcd(x,n)=1的个数 x从1到n int eular(int n){ int ret=1,i; for(i=2;ii<=n;i++) if(n%i==0){ n/=i; ret=i-1; while(n%i==0) n/=i,ret*=i; } if(n>1) ret*=n-1; return ret; } ...

2019-08-02 20:08:04 111

原创 二分查找

//二分查找(必须是已经排好的元素) /*#include using namespace std; int binarysearch(int a[],int size,int n){ int l=0; int r=size-1; while(l<=r){ int mid=l+(r-l)/2; if(n>a[mid]) l=mid+1; if(n<a[mid]) r=mid-1;...

2019-05-11 08:38:34 138

空空如也

空空如也

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

TA关注的人

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