#include <iostream> #include <assert.h> /** * Key: * * get someone bit: num & (mode1bit<<N) * * check a few bits: num & (mode3bit<<shift) == What */ i
分类:
编程语言 时间:
2016-02-22 23:28:51
阅读次数:
409
Magic Numbers 题意:给定长度不超过2000的a,b;问有多少个x(a<=x<=b)使得x的偶数位为d,奇数位不为d;结果mod 1e9+7; 直接数位DP;注意在判断是否f[pos][mod] != -1之前,要判断是否为边界,否则会出现重复计算; #include<bits/stdc
分类:
其他好文 时间:
2016-02-22 15:46:51
阅读次数:
171
开学了,不能愉快地刷题了QAQ 差分约束(以前用并查集做真是作死。。)然后有个点比较坑,要过的话就要倒着加边,否则TLE 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #define dec(i,l,r)
分类:
其他好文 时间:
2016-02-21 18:37:49
阅读次数:
178
先预处理编个顺序,然后用splay搞了。 涉及的操作:区间翻转,区间最小值查询。 //#include<bits/stdc++.h> #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<al
分类:
其他好文 时间:
2016-02-20 07:03:37
阅读次数:
189
线段树的题目,拿来练第一道splay维护区间。 像这种基本的操作修改查询,我现在应该能在20分钟手写好splay再用10分钟调试,基本上不靠模版30分钟应该能出。 //#include<bits/stdc++.h> #include<iostream> #include<cstdio> #inclu
分类:
其他好文 时间:
2016-02-19 06:55:49
阅读次数:
233
第一道splay,算是学会了最最基础的splay操作。 有一点要特别注意,就是一字型旋转的时候要先旋转y再旋x,这样复杂度降低很多。。。不要写成两次都旋转x。。。 #include<bits/stdc++.h> #define REP(i,a,b) for(int i=a;i<=b;i++) #de
分类:
其他好文 时间:
2016-02-18 13:30:46
阅读次数:
203
单词建出AC自动机,然后在自动机上做DP d[i][j]表示第i个字符匹配到节点j上的方案数 直接算有点麻烦,统计不满足的方案数就好了 1 #include<bits/stdc++.h> 2 #define inc(i,l,r) for(int i=l;i<=r;i++) 3 #define dec
分类:
其他好文 时间:
2016-02-17 00:49:02
阅读次数:
264
贪心 A - Guest From the Past 先买塑料和先买玻璃两者取最大值 #include <bits/stdc++.h> typedef long long ll; int main(void) { ll n, a, b, c; std::cin >> n >> a >> b >> c
分类:
其他好文 时间:
2016-02-16 20:46:23
阅读次数:
191
在家补补题 模拟 A - Robot Sequence #include <bits/stdc++.h> char str[202]; void move(int &x, int &y, char ch) { if (ch == 'U') x--; if (ch == 'D') x++; if (c
分类:
其他好文 时间:
2016-02-16 20:35:56
阅读次数:
256
AC自动机入门题,只是上来传个模板。。。 1 //#include<bits/stdc++.h> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<iostream> 6 #include<queue> 7
分类:
其他好文 时间:
2016-02-16 16:48:37
阅读次数:
224