- 博客(28)
- 收藏
- 关注
原创 Berlekamp Massey算法(HDU6172)
用途:常系数k阶递推式求值#include <bits/stdc++.h>using namespace std;#define rep(i, a, n) for (ll i=a;i<n;i++)#define SZ(x) ((ll)(x).size())typedef long long ll;const ll mod = 1000000007;ll p...
2018-08-27 14:41:48
997
原创 一个小玩意
<!DOCTYPE html><html><head><meta charset="utf-8"><title>我好菜啊</title><meta name="description" content=""><meta name=
2018-08-16 21:03:56
186
原创 zkw费用流
//zkw费用流#include <cstdio>#include <iostream>#include <cstring>using namespace std;const int MAXN = 20000 + 5;const int INF = 0x7f7f7f7f;int from[MAXN << 1], to[MAXN &l...
2018-08-14 20:10:59
262
转载 二分图最大匹配 Uva 11419(by:lrj)
// UVa11419 SAM I AM// Rujia Liu#include <cstdio>#include <cstring>#include <vector>using namespace std;const int maxn = 1000 + 5; // 单侧顶点的最大数目// 二分图最大基数匹配struct BPM { ...
2018-08-14 20:09:37
154
原创 二分图匹配-hungary算法(POJ1274)
#include <cstdio>#include <cstring>#include <vector>using namespace std;const int maxn = 2000 + 5; // 单侧顶点的最大数目// 二分图最大基数匹配struct BPM { int n, m; // 左右顶点个数...
2018-08-14 18:40:27
211
原创 一个方程(HOJ 1008)
Source: http://acm.hit.edu.cn/hojx/showproblem/1008/ n9⋅(10k+1−1)≡0(modm)n9·(10k+1−1)≡0(modm)\frac{n}{9}·(10^{k+1}-1)\equiv0(\mod {m}) 1≤n≤91≤n≤91\leq n\leq9 2≤m≤1042≤m≤1042\leq m \leq10^4 ∫x0t3et...
2018-03-07 14:24:59
192
翻译 VirtualBox上Ubuntu虚拟机反应慢
VirtualBox上Ubuntu虚拟机反应慢转自:http://blog.youkuaiyun.com/shangpusp/article/details/46762491手动汉化了一下原文 1.Select the Ubuntu 14.04 virtual machine and click the Settings button 2.Select the’Display’item from
2018-01-04 23:32:39
5275
原创 Python 字符串格式化 (%操作符)
自适应辛普森公式辛普森公式是数值方法中常用的计算函数定积分的近似方法。计算定积分的方法辛普森公式的推导其他N-C公式自适应方法计算定积分的方法求原函数直接查表 这个求不出来怎么办∫x0t3et−1dt∫0xt3et−1dt \int_0^x \frac{t^3}{e^t-1}\,dt 那就不求原函数数值积分辛普森公式的推导 辛普森(Simp...
2017-12-28 16:18:22
624
原创 搭建Eclipse下的C++编译环境
安装好Eclipse cpp oxygen以后,我发现我原来在cmd上用的MinGW居然不能用了,按照装Java时的经验,估计是环境变量没调好,况且我之前是下载的没编译好的MinGW,那就重新来装一波。从网上了解到TDM-GCC不错的,从http://tdm-gcc.tdragon.net/下载来它它包含了C/C++编译器、GDB、GNU make(这三个是搭建完整的eclipse
2017-12-22 00:22:14
985
转载 (转)Python 字符串格式化 (%操作符)
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明。谢谢! 在许多编程语言中都包含有格式化字符串的功能,比如C和Fortran语言中的格式化输入输出。Python中内置有对字符串进行格式化的操作%。 模板格式化字符串时,Python使用一个字符串作为模板。模板中有格式符,这些格式符为真实值预留位置,并
2017-10-23 19:33:43
239
原创 NOIP2015 运输计划 树链剖分 差分 二分
#include using namespace std;int n,m;int fst[MAXN],next[MAXN<<1],len[MAXN<<1],to[MAXN<<1],ec=0;int u[MAXN],v[MAXN];int cur[MAXN];int son[MAXN],size[MAXN],fa[MAXN],dep[MAXN],dfn[MAXN],top[MAXN];
2016-06-11 19:26:55
562
原创 noi2015 d1t2 软件包管理器
树链剖分 对于删除操作,之前不会写子树修改的时候暴力写了dfs最终发现原来只要将dfs序应用一下即可#include #include #include #include using namespace std;const int MAXN = 100000 + 5;int sum[MAXN<<2],lazy[MAXN<<2];int ec=0,fst[MAXN],to[MA
2016-06-03 22:01:18
712
原创 树链剖分codevs p4633
模板题 #include <bits/stdc++.h>#define lc (o<<1)#define rc (lc|1)#define m ((l+r)>>1)using namespace std;const int MAXN = 100000 + 5;int lazy[MAXN << 2], sum[MAXN <...
2016-06-01 19:22:13
283
原创 [noi2001]聪明的打字员 vijos p1673
#include #include #include using namespace std;int a,b,sa[8],sb[8],q[100005][8],head=0,tail=0;bool h[10][10][10][10][10][10][7];inline void mk(int*s){h[s[1]][s[2]][s[3]][s[4]][s[5]][s[6]][s[7]]=
2016-05-07 18:10:18
759
转载 splay
#include#include#define inf 1000000000using namespace std;int ans,n,t1,t2,rt,size;int tr[50001][2],fa[50001],num[50001];void rotate(int x,int &k){ int y=fa[x],z=fa[y],l,r; if(tr[y][0]==
2016-05-03 18:23:31
229
原创 treap模板
测试,自动去重151 2 3 4 5 6-51 15 2 22 22 2 2 #include #include #include #include using namespace std;const int MAXN = 80005;const int INF=0x7fffffff;int ch[MAXN][2],
2016-04-29 22:35:07
285
转载 treap by:刘汝佳
备忘 白书代码的基础上有部分改进// Rank Tree// Rujia Liu// 输入格式:// m 操作有m个// 1 x 插入元素x// 2 x 删除元素x。如果成功,输入1,否则输出0// 3 k 输出第k小元素。k=1为最小元素// 4 x 输出值x的“名次”,即比x小的结点个数加1#includestruct Node { Node
2016-04-29 20:54:31
469
原创 hdu2222
ac自动机,模板题#include #include using namespace std;const int MAXN = 500000+5;const int LEN = 50+5;const int SIGMA = 26;char a[LEN],b[MAXN*2];int trie[MAXN][SIGMA],q[MAXN],f[MAXN],val[MAXN],vis[MA
2016-04-27 15:05:01
224
原创 codevs p1285
数据结构模板题set#include #include #include using namespace std;const int INF = 0x7fffffff;const int MOD = 1000000;int main(){ set s; s.clear(); s.insert(INF); s.insert(-INF); int n; int ans
2016-04-27 14:52:55
414
原创 BKDRHash
一个简单的hash#include #include using namespace std;unsigned ans=0;unsigned BKDRHash(char *str){ unsigned seed = 131; // 31 131 1313 13131 131313 etc.. unsigned hash = 0; while (*str)has
2016-04-27 14:51:44
419
原创 vijos p1233
描述在直角坐标系中,给出n个顶点的坐标,求这n个点所围成的图形的周长和面积。注意:(1)如果所有点共线则周长按直线的长度计算,面积视为0;(2)如果部分点共线按共线后的多边形计算;(3)所给出的n个顶点如果能围成多边形均为突多边形。#include <bits/stdc++.h>using namespace std;const double EPS = 1e...
2016-04-26 11:58:42
351
原创 二维计算几何通用模板
#include <algorithm>using namespace std;const double EPS = 1e-10;const double PI = acos(-1);struct Point { double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {}};type...
2016-04-26 11:54:50
334
原创 ISAP(poj1273 / codevs1993)
关于ISAP:https://www.cnblogs.com/owenyu/p/6852664.html同时也是poj1273 / codevs1993的题解USACO的奶牛题,网络流模板这道题codevs上的数据很水...还要注意poj上是多组数据//poj1273 / codevs1993#include <queue>#include <cstdi...
2016-04-25 12:05:31
552
原创 费用流
//hdu3667#include <bits/stdc++.h>using namespace std;typedef long long ll;const ll MAXN = 100 + 5;const ll INF = 0x3f3f3f3f3f3f3f3f;const ll MAXM = 50000 + 5;//边数,要开成两倍ll fst[MAXN], ...
2016-04-24 17:40:32
229
原创 后缀数组
//后缀数组,尚有bug#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>//#define rep(i, a, b) for(int i=a;i<b;i++)using namespace std;const int MAXN ...
2016-04-24 17:36:01
225
原创 AC自动机(HDU2222 HDU3065)
//HDU2222#include <bits/stdc++.h>using namespace std;const int MAXN = 500000 + 5;const int SIGMA = CHAR_MAX;int f[MAXN], last[MAXN];struct trie { int ch[MAXN][SIGMA]; int val[MA...
2016-04-24 17:30:06
284
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人