04 2012 档案
zoj 3605 Find the Marble
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4708这题的dp还是不难想的,然后把状态转移时候的概率算上去就可以了代码中有注释View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstdlib> 4 #include<cstring> 5 using namespace std; 6 #define N 55 7 int a[N],b[N]; 8 double c[N][N]; //c[i][j] = i
阅读全文
zoj 3602 Count the Trees
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3602省赛的C题,方法是hash每个节点定义的状态。关键貌似要直接DFS递归会爆栈,所以我手写了一个栈模拟。下面还是贴没有模拟栈之前的代码,提交会sf,不过看起来会好理解很多,模拟部分可以自己去写。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstdlib> 4 #include<map> 5 #include<cstring> 6 u
阅读全文
The 9th Zhejiang Provincial Collegiate Programming Contest Summary
摘要:悲剧了,银第一...不过也在情理之中,因为最后C题还是没出。关键是C题模拟栈没写好...最后一个小时越来越乱了...不过队里的大牛说不用模拟栈他们也过了...于是乎我回学校写了下,发现还是sf,只好再模拟一个栈,把C过了...前5题都是水题,结果我们每题错一把,连K题都CE一把,唯一一把过的是F题的DP。希望下届省赛能发挥的好点。
阅读全文
有道面试
摘要:http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=14506有道面试Case Time Limit:1000msMemory Limit:65536KBDescription有N个村庄,村庄之间有N-1条路,每条路都有一个长度。这些村庄和路形成了一个树形结构。现在要求从某个村庄出发,通过这些路访问所有的村庄,起点村庄当做已经被访问过。现在有若干个村庄可以作为起点村庄。问访问全部的村庄所要走的路程之和最小是多少。Input输入的第一行为一个正整数N(1≤N≤100000)。接下来的N-1行每行三个数X,Y,Z(1<=X,Y<=N, 1&
阅读全文
hdu 4205 Parking Ships
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4205有很多船要停在自己的家前面,船长的船一定要停在家门口中间,输出最多多少个船在家门口。dp[i][j]=min(dp[i-1][j] , if(dp[i-1][j-1]<=w[i].x) max(dp[i-1][j-1]+w[i].li,w[i].x) ) 。。。碰到船长的船是固定的。View Code 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <a
阅读全文
hdu 4197 Popping Balloons
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4197题目说要飞最少的飞镖把所有气球穿破。对于任意一个气球,要把它打破,扔的飞镖必然是在它的两条切线的上下界内。然后排序,枚举起点定义方向进行贪心。View Code 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <math.h> 5 #include <algorithm> 6 #include <limits.h> 7 using
阅读全文
浙公网安备 33010602011771号