自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Q~Q

   换了个个人博客,以后这个应该很少用了,欢迎大家来我新博客(www.wakaka99.top)来玩。

2019-01-28 20:00:16 413

原创 [kuangbin专题] KMP

A:基础模板题#include<cstring>#include<cstdio>int n,m,next[1000001];long long int sum;char a[1000001],b[1000001];void Getnext(){ next[0]=-1; for(int i=1,j=0;i<m;i++,j++) { while(...

2019-01-15 17:00:45 280

原创 位运算

#include<iostream>using namespace std;int main(){ int n=15,m=8;//1111,1000 unsigned int x=8,y=7; cout<<__builtin_popcount(n)<<endl;//判断n中有几个1 cout<<__builtin_parity(n)...

2018-12-22 21:27:02 131

原创 CF round 525 div2 D. Ehab and another another xor problem

题目链接:http://codeforces.com/contest/1088/problem/D我们只需要通过两个数的大小和两次异或就能知道当前位是否为1,然后从后往前走,每个位次只需要两次就能判断出来为1还是0,所以需要60次,再加上最开始比较两个数的大小异或一次所以一共需要异或61次。#include<stdio.h>long long int i,j,m,n,sum...

2018-12-06 17:01:51 119

原创 第二次周赛题解

//E题,不懂的看新生训练题解 #include<stdio.h>int main(){ double m; int n; while (~scanf("%lf%d", &m, &n)) { printf("%.*lf\n", n, m); } return 0;}//D题,一个预处理就ok#inc...

2018-10-28 17:31:15 442

转载 高斯消元(模板)

#include<stdio.h> #include<algorithm> #include<iostream> #include<string.h> #include<math.h> using namespace std; const int MAXN=50; int a[MA...

2018-10-22 20:58:29 98

转载 BM

#include<bits/stdc++.h>using namespace std;#define rep(i,a,n) for (int i=a;i<n;i++)#define per(i,a,n) for (int i=n-1;i>=a;i--)#define pb push_back#define mp make_pair#define all(x) ...

2018-10-17 20:48:06 275

原创 nth_element

#include<stdio.h>#include<string.h>#include<algorithm>#include<math.h>#include<map>#include<unordered_set>using namespace std;typedef long long ll;int a[...

2018-10-16 19:05:55 1625

原创 奇怪的数列(二分)

 #include<stdio.h>#include<math.h> int main(){ long long int i,j,m,n; while(scanf("%lld",&n)!=EOF) { long long int l=-1,r=2e9,mid=(l+r)/2; while(r>l+1) { mid=(l...

2018-10-16 18:49:06 305

转载 新生训练

Problem A:ASCII码排序#include<stdio.h> int main(void){ char a,b,c; //定义三个字符变量 char temp; //定义一个用于交换的中间变量 while(~scanf("%c%c%c",&a,&b,&c)){ /*输入格式: 1...

2018-08-30 10:16:08 268

原创 ST算法

对于一个数组a[1],a[2],a[3]......构建一个Sparse Table表i 1 2 3 4 5 6 7 8 a 5 3 7 9 6 4 1 2 t0 5 3 7 9 6 4 1 2 t1 3 3 7 6...

2018-08-07 11:23:08 217

原创 凸包

一篇很不错的博客https://blog.csdn.net/bone_ace/article/details/46239187贴个大佬博客找的板子#include <algorithm>#include <cstdio>#include <cmath>const int N=1e5+5;const double eps=1e-6;int n,...

2018-08-04 09:58:19 437

原创 离散化

虽然题被卡时了,但是还是学了波离散化 sort(t+1,t+n+1); m=unique(t+1,t+1+n)-t-1;//消除重复的数,例如1 2 2 3 4 5变为1 2 3 4 5 2 for(i=1; i<=n; i++) a[i]=lower_bound(t+1,t+1+m,a[i])-t;//二分查找t[i]的...

2018-08-04 09:35:46 393

原创 Catalan 数

http://poj.org/problem?id=2084(Catalan 数)详情请看大佬博客https://fancypei.github.io/CodesProblemSolving2/ 

2018-08-03 11:40:43 112

转载 主席树(模板,听懂是不可能听懂的)

http://acm.hdu.edu.cn/showproblem.php?pid=2665(区间第k大)#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int N = 100000 + 5;int a[N], b[N], rt[N...

2018-08-03 10:29:14 127

转载 二次hash字符串

#include <cstdio>#include <iostream>#include <string>#include <algorithm>#include <cstring>#define LL long longusing namespace std;const LL D1=131;const LL D2=13...

2018-08-02 19:40:09 575

转载 排列组合

#include <cstdio>#include <iostream>#include <cmath>using namespace std;const int mod = 1e9+7;long long int N[100005];//n!打表long long int a[100005];void init(){ N[0] = N...

2018-08-01 18:05:58 200

原创 线段树的单点修改加区间修改

const int maxn=1e6+5;int a[maxn]; //存每个数的值struct node{ int sum; int ll,rr;}tree[maxn*4];void Pushup(int id) //区间合并{ tree[id].sum=tree[id*2].sum+tree[id*2+1].sum;}void P...

2018-08-01 10:45:29 394

转载 求逆序对

归并排序求逆序对#include<cstdio>#include<cstdlib>#include<cstring>#include<iostream>#include<cmath>#include<algorithm>#include<vector>#include<stack&

2018-07-31 14:44:26 290

原创 线性筛

线性筛,复杂度 o(n)for(int i=2;i<=n;i++){ if(!prime[i]) isprime[++num]=i; for(int j=1;j<=num&&i*isprime[j]<=n;j++) { prime[i*isprime[j]]=1; if(i%isprime[j]==0) break; } } ...

2018-07-04 19:57:24 113

原创 python 学习笔记(3)

一,基础语法1,py3和2 的差距挺大的,就3和2对比着学习吧,3中的输出多看了个括号,输出格式为print();例:2,读取python的保留字,即关键字,这些字符我们不能用来做任何标识符的名称,python提供的keyword模板可以读取这些关键字3,注释,同2,为#4,缩进相同的可以当做一个代码块相当于c中的大括号,与2相同5,数字类型也与2差不多,有int(整数)bool(布尔)float...

2018-06-26 15:41:00 109

原创 python学习笔记(2.7学习笔记,仅供参考)

一,数据类型:python数据类型和c差不多1,整数:16进制用0x前缀2,浮点数:0.000012可以写成1.2e-5 3,字符串:以‘ ’或“ ”括起来的任意字符4,布尔值:只有TRUE和FALSE 有and or not运算,运算规则和c类似5,空值:用None表示,不等于0二,输出用print,多个字符串用“ ”,“ ”,逗号位置输出为空格,可以打印整数或直接计算出结果,注释为在前面加#三...

2018-06-24 17:44:21 372

原创 2018省赛

J 难受得一批的体验#include<stdio.h>#include<algorithm>#include<queue>using namespace std;int a[1000005];int s[10000005];int main(){ int t,i,j,n; scanf("%d",&t); while(t--) { ...

2018-06-04 15:55:48 197

原创 扣朴排序(VECTOR,DFS)

Vector//Kahn算法,关键在于需要维护一个入度为0的顶点的集合int n,m;int inDeg[N]; //i点的入度vector<int>vec[N]; //i点的邻接表,即i与哪些点相连int ans[N]; //排序结果数组int topSort() //返回值代表是否有环,排序结果在ans数组{ int cnt=0; q...

2018-05-30 14:17:49 240

转载 三分

标准3分,3等分double three_devide(double low,double up) { double m1,m2; while(up-low>=eps) { m1=low+(up-low)/3; m2=up-(up-low)/3; if(f(m1)<=f(m2)) ...

2018-05-14 20:55:26 128

转载 最短路(板子)

//1.Floyd算法,多源无负权//通过邻接矩阵跑出所有点之间的最短路,时间复杂度O(n^3),空间复杂度O(n^2)//d[i][j]表示i到j的最短路径长度,初始化:d[i][i]=0,点到点有路按正常权值初始化,其余INFint mp[n][n];int d[n][n];void Floyd(){ for(int i=1;i<=n;i++) fo...

2018-05-14 19:13:32 299

原创 kmp——官渡之战

#include <cstdio> #include <iostream> #include <cstring> using namespace std; const int N = 1000002; int Next[N]; char S[N], T[N]; int slen, tlen;//注意每次一定要计算长度 ...

2018-05-10 12:01:56 127

原创 米勒拉宾素数测试

ll quick_pow(ll a,ll b,ll r)//快速幂 { ll ans = 1; while(b) { if(b&1)ans=(ans*a)%r; a = (a*a)%r; b>>=1; } return ans;}bool Miller_Rabbin(int n,int...

2018-05-10 11:02:56 830

原创 [kuangbin带你飞]专题十六 KMP

第一题,很简单的板子题,只需要把char 改成int类型就好了#include <cstdio> #include <iostream> #include <cstring> using namespace std; const int N = 1000005; int Next[N]; int S[N], T[N]; int ...

2018-05-07 16:53:30 159

转载 kmp

/*pku3461(Oulipo), hdu1711(Number Sequence)这个模板 字符串是从0开始的Next数组是从1开始的 求T串是否为S串的子串主串为 abdabdabc S串 模式串 abdabc T串S[0]=T[0] S[1]=T[1],S[2]=T[2]...S[4]=T[4]S[5]!=T[5] 一般情况下重新匹配S[1]和T[...

2018-05-04 21:21:00 703

原创 树状数组

#include<stdio.h>int tree[1000000],n;int lowbit(int x){ return x&(-x);}int Query(int x)//查询x项的前缀和 ; { int res=0; while(x) {  res+=tree[x];  x-=lowbit(x);  } return res;}void ...

2018-05-04 20:46:58 92

原创 小希的迷宫(简单并查集)

#include<stdio.h> int pre[100005]; int find(int x) { int i,j,r,m,n; r=x; while(pre[r]!=r) { r=pre[r]; } m=x; while(m!=r) { i=pre[m]; pre[m]=pre[r]; m=i; } retu...

2018-05-02 22:17:39 445 2

原创 lower_bound&&upper_bound专题

#include<stdio.h> #include<algorithm>using namespace std;int main(){ int i,j,m,n,retrn,xiaoyu,dayu,retrn1,retrn2,zuida,zuixiao,k; int a[100005]; while(scanf("%d",&n)!=EOF) { ...

2018-05-01 19:29:38 120

原创 浙江省 Now Loading!!!

前面预处理,将分母等于1,2,3。。。时对应的和保存,因为2 的30 次方差不多等于1e9,所以可以开二维数组储存,但是好像可以优化,然后计算时用二分查询,查询出p-p方,p方-p3方。。。。,然后直接调用值加起来就是了,做法比较水,卡内存过了,应该还有其他的方法#include<cstdio>#include<cmath>#include<cstring>...

2018-04-30 17:40:28 499

转载 二进制枚举子集

#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>#include <cstdlib>#include <string>using namespace std;int main(){ int n, s[50...

2018-04-23 18:01:18 204

原创 uva10815

学了很多东西,但都还是一知半解,慢慢来吧。。。。。主要学会了怎么用set,set按字典序的大小储存,所以可以不用排序,直接输出就ok,然后,半抄半学的代码#include<stdio.h>#include<algorithm>#include<string.h>#include<set>#include<sstream>#inc...

2018-04-02 17:33:53 1101

原创 二分

二分,查找第一个大于j的下标,了解下,原来用了那么久的二分是有bug的,难受 int l=-1,r=n,mid;//长度 while(r>l+1) { mid=(l+r)/2; if(a[mid]>j) { r=mid; } if(a[mid]<=j) { l=mid; } }htt...

2018-04-02 10:35:25 100

原创 lower_bound

#include<stdio.h>#include<algorithm>using namespace std;int main(){ int i,j,m,n,a[100005],tmp,k=0; while(scanf("%d %d",&n,&m)!=EOF) { if(n==m&&m==0) break; k++...

2018-04-01 19:46:05 191

原创 棋盘问题(dfs)

#include<stdio.h>#include<string.h>char a[10][10],vis[10];int sum,n,m,qum;void dfs(int i){ int j; if(qum==m) { sum++; return;/*返回(在函数中,如果碰到return 语句,那么程序就会返回调用该函数的下一条语句执行,也...

2018-03-29 21:01:15 367

原创 容斥问题

#include<stdio.h>#include<algorithm>#include<iostream>#include<math.h>#include<string.h>using namespace std;int main(){ long long int i,a,b,c,d,j,m,n,t; scanf...

2018-03-26 10:33:32 272

空空如也

空空如也

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

TA关注的人

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