03 2014 档案

 
HDU 3986
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3986从开始的最短路里依次删一条边,求新的最短路,求最长的最短路删边操作要标记节点以及节点对应的边#include #include #include #include using namespace std ;c... 阅读全文
posted @ 2014-03-19 00:55 LegendaryAC 阅读(381) 评论(0) 推荐(0)
HDU 2175
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2175做得好辛苦的一道规律题,至于为什么辛苦。。dont ask me why。。。n号盘子出现的位置是(1,3,5,7......)*2^(n-1)#include using namespace std ;typedef __int64 ll ;int main(){ ll a[105] ; a[1]=1 ; for(int i=2 ;i<64 ;i++) a[i]=a[i-1]*2 ; ll n,m ; while(~scanf("%I64d%I64d",&n... 阅读全文
posted @ 2014-03-14 23:15 LegendaryAC 阅读(207) 评论(0) 推荐(0)
HDU 1535
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1535水题单向图,从1到P所有点,再从所有点回到1,问最小花费先求一遍1的最短路,然后反向建图,再求一遍1的最短路#include #include using namespace std ;const int I... 阅读全文
posted @ 2014-03-14 19:32 LegendaryAC 阅读(212) 评论(0) 推荐(0)
spfa
摘要:可判环,可算负权边,编码简单,很强的算法int spfa(int s){ for(int i=1 ;i q ; q.push(s) ; ct[s]++ ; while(!q.empty()) { int u=q.front() ; q.pop... 阅读全文
posted @ 2014-03-12 21:18 LegendaryAC 阅读(170) 评论(0) 推荐(0)
HDU 2323
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2323把六边形抽象成坐标进行dp,抽象出的坐标关系必须满足六边形之间的关系。很有趣的一道dp#include using namespace std ;int dp[25][25][25] ;int main(){ dp[0][7][7]=1 ; for(int i=1 ;i<=14 ;i++) { for(int j=0 ;j<=14 ;j++) { for(int k=0 ;k<=14 ;k++) dp[i]... 阅读全文
posted @ 2014-03-09 21:25 LegendaryAC 阅读(186) 评论(0) 推荐(0)
无言以对
摘要:我只想说,因式分解,我这辈子都忘不掉怎么写map M ;int temp=x ;for(int i=2 ;i*i1)M[temp]=1 ;//忘了这句话就是SB View Code 阅读全文
posted @ 2014-03-04 22:24 LegendaryAC 阅读(143) 评论(0) 推荐(0)