上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页

2015年4月5日

POJ 3070 矩阵快速幂

摘要: 裸题,最简单fib的应用模板,算是新技能get 吧。 其实和快速幂差不多了,只是矩阵代替的递推式。 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxn = 1005; 6 struct node... 阅读全文

posted @ 2015-04-05 23:59 round_0 阅读(106) 评论(0) 推荐(0) 编辑

2015年3月25日

UVa 11806 组合数+容斥原理

摘要: 裸题,刚接触这东西,觉得还不错,存个代码。 基本上和大白上写的一样。 1 #include 2 #include 3 const int maxn = 405; 4 const int mod = 1000007; 5 int c[maxn][maxn]; 6 void init() 7 ... 阅读全文

posted @ 2015-03-25 21:20 round_0 阅读(120) 评论(0) 推荐(0) 编辑

2015年3月19日

TYVJ 1038忠诚 ST 求区间最值

摘要: 已经不搞ACM了,就是最近随便做点题,就在这里存个代码 1 #include 2 #include 3 using namespace std; 4 const int maxn = 100005; 5 int a[maxn][20]; 6 int x[maxn]; 7 void i... 阅读全文

posted @ 2015-03-19 23:36 round_0 阅读(145) 评论(0) 推荐(0) 编辑

2015年2月1日

莫队算法

摘要: 特意学了一下莫队算法,做了几个题,总结一下。 目前还只是学了线性序列的莫队的分块,没有学什么曼哈顿最小生成树。分开的写法也挺简单粗暴明了(据说曼哈顿距离的最小生成树并不好写)时间复杂度是O(n*sqrt(n))。 做了几个题感觉莫队最主要的还是三个内容 1、离线 2、分块计算 3、由[... 阅读全文

posted @ 2015-02-01 17:45 round_0 阅读(341) 评论(0) 推荐(0) 编辑

2015年1月26日

UVA10891 Game of Sum 区间DP

摘要: 好像带点博弈,又好像没有。 设dp[i][j] 为[i,j]区间内先手得分的最大值(这里的先手不一定是指player A!) 这时候只需要枚举出现在的先手会取哪一边,取几个,然后现在的最优状态就可以由以前的状态推出来 那么dp[i][j] = sum[i,j]-min(dp[i+... 阅读全文

posted @ 2015-01-26 13:03 round_0 阅读(135) 评论(0) 推荐(0) 编辑

2015年1月24日

LA 2965 Jurassic Remains

摘要: 虽说是暴力题,但还是有很多很多的技巧与细节。 这题: 1、熟悉了位运算符,感觉异或操作的逼格有高了一级 2、可以用一个数的2进制来表示集合(这个需要多用) 3、中途相遇法。。。其实就是把总的集合拆成两半,降低指数使得暴力可解。(前段时间的中南校赛,好像也有个这种方法的题) #inclu... 阅读全文

posted @ 2015-01-24 14:34 round_0 阅读(109) 评论(0) 推荐(0) 编辑

2015年1月23日

LA3695 Distant Galaxy

摘要: 对于这种题真的是一点想法都没有,根本不知道从哪里下手。。。 还是大白上的题(P52),有详解。 书上说的枚举上下边界是指求出总共有多少种不同的纵坐标的值,因为题目中给出的坐标都是整数,每个纵坐标值都可以做为一个边界,这样就只有有限的组合。 还有一开始很困惑的地方就是,为什么求出的矩... 阅读全文

posted @ 2015-01-23 16:09 round_0 阅读(196) 评论(0) 推荐(0) 编辑

2015年1月22日

LA3905 流星(Meteor)

摘要: 很麻烦的一个题,有很多的技巧可以学到 #include #include #include #include using namespace std;typedef long long LL;const int maxn = 100005;const int INF = 0x3ffffff... 阅读全文

posted @ 2015-01-22 16:14 round_0 阅读(181) 评论(0) 推荐(0) 编辑

LA2678 Subsequence子序列

摘要: 感觉还不错又简单的的一个题 #include #include using namespace std;const int maxn = 100005;const int INF = 0x3f3f3f3f;int a[maxn];int main(){// freopen("in... 阅读全文

posted @ 2015-01-22 12:11 round_0 阅读(100) 评论(0) 推荐(0) 编辑

UVA11549 Calculator Conundrum 计算器谜题

摘要: 就觉得这题的暴力解法时间复杂度应该会很高,可能循环节会比较小吧 比较好的收获就是这个Floyd判环法 #include #include #include #include using namespace std;typedef long long LL;const int maxn = 1... 阅读全文

posted @ 2015-01-22 10:48 round_0 阅读(108) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页

导航