2015年9月28日

hdu 5492 Find a path

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=5492化简该式得(n+m-1)*SA-sum*sum;式中SA为路径的平方和逐项拆开得(n+m-2)*mp[i]*mp[i][j]-mp[i][j]*(S);式中S为mp[i][j]之前所有项和然后对于所有的sum... 阅读全文

posted @ 2015-09-28 18:44 此剑之势愈斩愈烈 阅读(120) 评论(0) 推荐(0) 编辑

2015年9月21日

hihocoder 北京网赛 boxs #1233 : Boxes

摘要: 根据汉诺塔的特点找到保存状态的最简方式。懂得hash的真谛才能ac qaq首先从有序状态可以推出所有有解状态。大体是给每个不同的数字以不同的模,根据他们的位置分别哈希,加起来作为该种状态的哈希值。这样可以根据这个哈希值取得各个数字的位置,得到当前情况。打表出各种移动的所需要的代价,即可转移到下一个状... 阅读全文

posted @ 2015-09-21 19:17 此剑之势愈斩愈烈 阅读(163) 评论(0) 推荐(0) 编辑

2015年9月20日

hdu 5459 Jesus Is Here 沈阳网赛

摘要: 按照这个规律找出来的不断取模之下会得负数。需要(ans+mod)%mod,化为正数。#include#include#includeusing namespace std;#define ll __int64const ll mod=530600414;const int maxn=201399;l... 阅读全文

posted @ 2015-09-20 11:40 此剑之势愈斩愈烈 阅读(118) 评论(0) 推荐(0) 编辑

2015年9月17日

light oj 1011Marriage Ceremonies

摘要: 总结状压dp板子。强迫症预处理,多写了几行但非常快#include#include#includeusing namespace std;const int INF=0x3f3f3f3f;const int maxn=16;int dp[10) { if(x&1) ans++; x>>=1; }... 阅读全文

posted @ 2015-09-17 22:37 此剑之势愈斩愈烈 阅读(140) 评论(0) 推荐(0) 编辑

#1184 : 连通性二·边的双连通分量

摘要: 贴板子。求割边。将>改为>=即可判断u是否为割点。#include#include#includeusing namespace std;const int INF=0x3f3f3f3f;const int maxn=20008;const int maxm=100008;struct fuck{ ... 阅读全文

posted @ 2015-09-17 22:04 此剑之势愈斩愈烈 阅读(149) 评论(0) 推荐(0) 编辑

2015年9月16日

uva 10596 欧拉回路

摘要: 判断是否存在欧拉回路只要两个条件图连通,不存在奇度点注意特判边为0的情况。另外这题数据坑。#include#include#includeusing namespace std;const int maxn=208;struct fuck{int u,v,next;}edge[maxn*maxn];... 阅读全文

posted @ 2015-09-16 21:47 此剑之势愈斩愈烈 阅读(117) 评论(0) 推荐(0) 编辑

2015年9月14日

hihocoder #1195 高斯消元一

摘要: hihocoder对算法解释得很详细,就复制粘贴来了首先我们要计算出上三角矩阵,也就是将方程组变为:a[1][1] * x[1] + a[1][2] * x[2] + ... + a[1][n] * x[n] = y'[1] 0 * x[1] + a[2][2] * x[2] + ... ... 阅读全文

posted @ 2015-09-14 21:18 此剑之势愈斩愈烈 阅读(171) 评论(0) 推荐(0) 编辑

2015年9月13日

hdu 5444 Elven Postman长春网赛

摘要: 5444 2333建二插排序树,dfs一遍,之后o(1)应对查询#include#include#include#includeusing namespace std;const int maxn=1008;struct fuck{ int left,right;}poi[maxn];int tol... 阅读全文

posted @ 2015-09-13 20:19 此剑之势愈斩愈烈 阅读(127) 评论(0) 推荐(0) 编辑

hdu 5441 Travel 长春网赛

摘要: 想到最小生成树的sort+并查集算法,于是可以顺便用并查集维护点所在的连通分量的点的数目(不知道学名是不是这么说),记为poi[v];然后当边权限制为f[i].w时,其答案为ww[i]=ww[i-1]-(poi[u]-1)*poi[u]-(poi[v]-1)*poi[v]+(poi[u]+poi[v... 阅读全文

posted @ 2015-09-13 20:15 此剑之势愈斩愈烈 阅读(146) 评论(0) 推荐(0) 编辑

hdu 5438 Ponds 长春网赛1002

摘要: 5438 好吉利的题号不停的删掉度数小于等于1的点并更新各点度数,直至无法删点,然后dfs即可#include#include#include#includeusing namespace std;#define ll __int64const int maxm=100008;const int m... 阅读全文

posted @ 2015-09-13 19:58 此剑之势愈斩愈烈 阅读(185) 评论(0) 推荐(1) 编辑

导航