摘要: http://codeforces.com/contest/766/problem/D D. Mahmoud and a Dictionary time limit per test 4 seconds memory limit per test 256 megabytes input standa 阅读全文
posted @ 2017-02-17 10:22 BOSON+CODE 阅读(285) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <algorithm> #include <iostream> #include <string.h> #include <stack> #define MAXN 100050 #define INF 2000000000000000000LL 阅读全文
posted @ 2017-01-02 20:35 BOSON+CODE 阅读(421) 评论(0) 推荐(0) 编辑
摘要: 首先来介绍一下泰森多边形: http://baike.baidu.com/link?url=LJh2DpARPjkmH3OUKHnW6pKg5AxjZdJLxrGanoJr2WApK2_j87MK1RRuxZAnslAiQjnGkh7gDSgiAv0GwDv_7cKIlpuM7iLRA69liVJE 阅读全文
posted @ 2017-01-02 19:44 BOSON+CODE 阅读(2179) 评论(0) 推荐(0) 编辑
摘要: pku 1160 Post Office 四边形不等式优化 经典DP pku 1160 Post Office 四边形不等式优化 经典DP pku 1160 Post Office 四边形不等式优化 经典DP 邮局 经典的动态规划问题,主要体现在状态的设计和可以用四边形不等式优化上 题意是:给你n个 阅读全文
posted @ 2016-12-27 01:24 BOSON+CODE 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 容斥原理 从上面的代码可以发现,显然这种筛法只能应付达到1e7这种数量级的运算,即使是线性的筛选法,也无法满足,因为在ACM竞赛中,1e8的内存是极有可能获得Memery Limit Exceed的。 于是可以考虑容斥原理。 以AHUOJ 557为例,1e8的情况是筛选法完全无法满足的,但是还是考虑 阅读全文
posted @ 2016-12-26 12:54 BOSON+CODE 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 摘自百度百科:http://baike.baidu.com/link?url=Jp9yFYcnnuDrvSWgq_dbq0-kGkEDBS7jmpktp7V310DC7zxpNTM5aAQbFpi35AORkTgOz_e5woBJcaqqvZsbJg3rmc_14O6akbmNIQMEj5q59Zg 阅读全文
posted @ 2016-12-24 23:57 BOSON+CODE 阅读(178) 评论(0) 推荐(0) 编辑
摘要: af[n-1] + b[n-2] (a >= b 且a, b都是斐波那契数) 那么这个式子就表示 以a b为前两项的斐波那契数的第n项斐波那契数 http://blog.csdn.net/qq_24451605/article/details/48105763 题目链接: codeforces 44 阅读全文
posted @ 2016-12-14 13:42 BOSON+CODE 阅读(276) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; const int maxn = 2e6; int head[maxn]; int bel[maxn]; int w[maxn]; bool vis[maxn]; int cnt = 0, n; struct node{ int to, nxt; }e[maxn]; void init(){ memset(hea... 阅读全文
posted @ 2016-11-20 03:55 BOSON+CODE 阅读(164) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define DEPTH 10 typedef int BigInteger[10100]; int comp(const BigInteger a,const int c,const int d,const BigInteger b) //大数比较 { int i,t=0,O=-DEPTH*2; if(b[0]... 阅读全文
posted @ 2016-11-17 05:12 BOSON+CODE 阅读(234) 评论(0) 推荐(0) 编辑
摘要: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1355 斐波那契数列定义如下: F(0) = 0 F(1) = 1F(n) = F(n-1) + F(n-2) 给出n个正整数a1, a2,...... an,求对应的斐波那 阅读全文
posted @ 2016-11-17 01:43 BOSON+CODE 阅读(586) 评论(0) 推荐(0) 编辑