HDU
Viko_ReCode
这个作者很懒,什么都没留下…
展开
-
HDU 4302
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4302 通过本题初步了解STL模板优先队列的运用 priority_queue less让优先队列以从大到小的顺序排列,先出队的是最大元素 greater让优先队列以从小到大的顺序排列,先出队的是最小的元素 #include #include #include using原创 2013-08-02 19:44:28 · 432 阅读 · 0 评论 -
HDU 4255 (筛素数+BFS寻最短路径长度)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4255 本题有一个小trick,虽说给定的数的范围是[1,10000],但有可能存在一条绕出100*100的矩阵(包含1-10000的数的矩阵)的从起点到达终点的路径,比完全位在100*100矩阵(包含1-10000的数的矩阵)当中的从起点到达终点的最短路径的长度还要短,于是,便要扩大矩阵,为特殊情况原创 2013-08-07 12:31:10 · 551 阅读 · 0 评论 -
HDU 1520 Anniversary party (基础树形DP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1520 #include #include #include using namespace std; const int N = 6666; int v[N], fa[N], dp[N][2]; vector vec[N]; void dfs(int rt) { int l原创 2013-08-16 17:08:34 · 397 阅读 · 0 评论 -
HDU 4681 String (最长公共子序列)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4681 #include #include #include using namespace std; #define fi first #define se second const int N = 1111; char a[N], b[N], c[N]; int dp1[N][N], d原创 2013-08-16 12:41:33 · 445 阅读 · 0 评论 -
HDU 1496 Equations
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1496 #include #include int hash[2001000], p[101]; int main( ) { int a, b, c, d; for(int i=1; i<101; i++) p[i] = i*i; while(~scanf(原创 2013-10-09 23:49:13 · 347 阅读 · 0 评论 -
hdu 2544 最短路 (Dijstra + Heap优化)
HDU 2544 #include #include #include using namespace std; const int maxn = 11111; const int inf = (int)1e9; struct Edge { int v, next; int cost; Edge() {} Edge(int a, int b)原创 2013-11-08 21:40:25 · 410 阅读 · 0 评论 -
HDU 4686 Arc of Dream (矩阵快速幂)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4686 根据题意可得: 递推矩阵如下: 代码如下: #include #include const int mod = 1000000007; const int matSize = 5; long long n, a0, ax, ay, b0,原创 2013-09-13 10:22:38 · 411 阅读 · 0 评论