2018年9月11日

hdu 4763 看毛片(单纯next数组的应用--纯正O(n))

摘要: 因为需要负责队内的字符串题,开始刷,做到这道,开始想不出来,上网找题解, 然后就惊了,为什么你们这么暴力都可以过的啊,1e6啊,后来又想了下会做了 贴下代码 假设E在字符串中的三次匹配为A B C,那么A必在B和C的fail链中 C是字符串的后缀 枚举B的结束位置为x,那么A在B的fail链中出现, 阅读全文

posted @ 2018-09-11 21:29 scau_bi 阅读(9745) 评论(0) 推荐(0) 编辑

2018年9月9日

乘法取模优化

摘要: inline long long multi(long long x,long long y,long long mod)//mod long long { long long tmp=(x*y-(long long)((long double)x/mod*y+0.5)*mod); return tmp<0 ? tmp+mod : tmp; } int pdt(int x,... 阅读全文

posted @ 2018-09-09 11:40 scau_bi 阅读(832) 评论(0) 推荐(0) 编辑

2018年9月8日

半径R覆盖最多点

摘要: struct point { double x, y; }; point p[N]; struct alpha { double v; bool flag; bool friend operator 2.0 * R) continue; theta = atan2(p[j].y - p[i].y, p[j]... 阅读全文

posted @ 2018-09-08 17:10 scau_bi 阅读(236) 评论(0) 推荐(0) 编辑

两点求直线一般方程 + 两直线求交点

摘要: void jj(ll x1,ll y1,ll x2,ll y2,ll&A,ll&B,ll&C){ A=y2-y1; B=x1-x2; C=x2*y1-x1*y2; } bool px(ll x1,ll y1,ll x2,ll y2){ return x1*y2==x2*y1; } void getjiao(){//1-2 3-4 ll x1,y1,x... 阅读全文

posted @ 2018-09-08 01:01 scau_bi 阅读(731) 评论(0) 推荐(0) 编辑

2018年8月27日

Atcoder ARC101 E 树dp

摘要: https://arc101.contest.atcoder.jp/tasks/arc101_c 题解是也是dp,好像是容斥做的,但是看不懂,而且也好像没讲怎么变n^2,看了写大佬的代码,自己理解了一下 阅读全文

posted @ 2018-08-27 15:46 scau_bi 阅读(343) 评论(0) 推荐(0) 编辑

2018年8月24日

拉格朗日插值法板子(dls)

摘要: namespace polysum { const int D=101000; ll a[D],f[D],g[D],p[D],p1[D],p2[D],b[D],h[D][2],C[D]; ll calcn(int d,ll *a,ll n) {//d次多项式(a[0-d])求第n项 if (n<=d) return a[n]; p1[0]=... 阅读全文

posted @ 2018-08-24 12:24 scau_bi 阅读(437) 评论(0) 推荐(1) 编辑

2018年8月23日

输入挂(板子)

摘要: struct FastIO { static const int S = 1000 inline void read(T &x); template inline Reader& operator >> (T &x) { read(x); return *this; } } rd; inline char Reader::nc() { static char buf[... 阅读全文

posted @ 2018-08-23 14:54 scau_bi 阅读(182) 评论(0) 推荐(0) 编辑

2018年7月20日

拉格朗日插值法(板子)

摘要: double Lagrange(int N,vector&X,vector&Y,double x) { //数据类型视情况改变 //N-插值点的个数,k次多项式要插k+1个点 //X,Y两个vector存xi,yi //x--求f(x) double result=0; for(int i=0; i>N; vectorX(N,0);... 阅读全文

posted @ 2018-07-20 17:55 scau_bi 阅读(294) 评论(0) 推荐(0) 编辑

伯努利数求幂和(板子)

摘要: ll qpow(ll a,ll b){ ll res=1; while(b){ if(b&1) res=res*a%mod; b>>=1; a=a*a%mod; } return res; } ll c[maxn][maxn], inv[maxn], B[maxn]; void exgcd(ll a,... 阅读全文

posted @ 2018-07-20 16:10 scau_bi 阅读(272) 评论(0) 推荐(0) 编辑

2018年3月7日

wannafly 挑战赛9 D 造一造 (卡特兰数)

摘要: 链接:https://www.nowcoder.com/acm/contest/71/D 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 空间限制:C/C++ 262144K,其他语言524288K 阅读全文

posted @ 2018-03-07 21:52 scau_bi 阅读(208) 评论(0) 推荐(0) 编辑

导航