随笔分类 - ACM-ICPC
摘要:用了一下午时间重刷了一次校赛题目 不参考资料做的还是2333 第一题手速题 第二题 一开始取余运算少加了一个,WA了一发 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { i
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1533 这道题直接用了模板 题意:要构建一个二分图,家对应人,连线的权值就是最短距离,求最小费用 要注意void init(int n) 这个函数一定要写 一开始忘记写这个WA了好几发 还有这个题很容易T掉,赋值建
阅读全文
摘要:http://poj.org/problem?id=3641 练手用,结果念题不清,以为是奇偶数WA了一发 #include<iostream> #include<cstdio> #include<cmath> using namespace std; typedef long long ll; b
阅读全文
摘要:http://poj.org/problem?id=1995 简单的快速幂问题 要注意num每次加过以后也要取余,否则会出问题 #include<iostream> #include<cstdio> using namespace std; typedef long long ll; ll mod_
阅读全文
摘要:http://poj.org/problem?id=2631 2333水题, 有一个小技巧是说随便找一个点作为起点, 找到这个点的最远点, 以这个最远点为起点, 再次找到的最远点就是这个图的最远点 证明可以用三角形定理 #include<iostream> #include<cstdio> #inc
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2853 这道题初看了没有思路,一直想的用网络流如何解决 参考了潘大神牌题解才懂的 最大匹配问题KM 还需要一些技巧来解决最小变动, 做法是:把原先的邻接矩阵每个数扩大k倍(k>n) 为了突出原先的选择,也就是同等情
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2819 这道题乍一看是矩阵变换题,估计用矩阵之类的也可以做 但是分析一下就可以知道 要凑成对角线都是1,题目允许行变换和列变换 然而观察可以得知如果可以完成只需要行变换或者列变换之一即可 donser[i][j]=
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1083 二分图匹配用得很多 这道题只需要简化的二分匹配 #include<iostream> #include<cstdio> #include<cstring> #define maxm 410 using na
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3549 同样的网络最大流 T了好几次原因是用了cout,改成printf就A了 还有HDU oj的编译器也不支持以下的写法 G[from].push_back((edge){to,cap,G[to].size()}
阅读全文
摘要:http://poj.org/problem?id=1273 这道题很值得反思,弄了一下午,交上去先是一直编译错误,而在本地运行没有问题, 原因可能是oj的编译器版本老旧不支持这样的写法 G[from].push_back((edge){to,cap,G[to].size()}); G[to].pu
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2855 化简这个公式,多写出几组就会发现规律 d[n]=F[2*n] 后面的任务就是矩阵快速幂拍一个斐波那契模板出来了 这里用的是2维 vector #include<iostream> #include<cstd
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2860 n个旅,k个兵,m条指令 AP 让战斗力为x的加入y旅 MG x旅y旅合并为x旅 GT 报告x旅的战斗力 几个需要注意的小问题是:已经被合并过的不能再参加合并这样就简化了并查集本身的复杂度只存在一层继承关系
阅读全文
摘要:Patti and Terri run a bar in which there are 15 stools. One day, Darrell entered the bar and found that the situation how customers chose the stools w
阅读全文
摘要:并查集模板#include#define max 100000int N,K;int T[max],X[max],Y[max];int par[max],rank[max];void init(int n){ for(int i=0;i<n;i++) { par[i]=i;...
阅读全文
摘要:一 Prim算法/*POJ1258有n个农场,已知这n个农场都互相相通,有一定的距离,现在每个农场需要装光纤,问怎么安装光纤能将所有农场都连通起来,并且要使光纤距离最小,输出安装光纤的总距离数据:(几个点,矩阵表示各点中间的距离)40 4 9 214 0 8 179 8 0 1621 17 16 0...
阅读全文
摘要:The order of a TreeProblem DescriptionThe shape of a binary search tree is greatly related to the order of keys we insert. To be precisely:1.insert a ...
阅读全文
摘要:Binary Tree TraversalsProblem DescriptionA binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binar...
阅读全文
摘要:http://xcacm.hfut.edu.cn/contest.php?cid=1009打了一下午,最后一道题2333,前面比较基础。问题 A: 求成绩最大值和最小值题目描述GX是宣城校区A班的一名同学,如果GX在B班的话,那么这两个班的平均成绩都会提高.现在给出A班与B班的人数以及成绩,求GX成...
阅读全文
摘要:HDU模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 ...
阅读全文
摘要:Problem DescriptionOne day, Lin Ji wake up in the morning and found that his pethamster escaped. He searched in the room but didn’t find the hamster. ...
阅读全文

浙公网安备 33010602011771号