摘要: 题目链接:http://codeforces.com/problemset/problem/342/A题目意思:给出n个数,找出n/3个组且每组有3个数,这三个数必须要符合两个条件:1、a = s[4],否则对于类似1 3 4 的数据是过不了的!!!! 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn = 99999 + 5; 8 int s[maxn]; 9 10 int main()11 {12 int n, i, flag, temp;13 ... 阅读全文
posted @ 2013-09-07 23:23 windysai 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1213 有关系(直接或间接均可)的人就坐在一张桌子,我们要统计的是最少需要的桌子数。并查集的入门题,什么优化都无用到就可以直接过。实质上就是统计总共有多少个不相交的集合。比较可恶的是,题目中 There will be a blank line between two cases 是骗人的!!! 1 #include 2 using namespace std; 3 4 const int maxn = 1000 + 5; 5 int p[maxn], rank[maxn]; 6 7 int ... 阅读全文
posted @ 2013-09-07 20:04 windysai 阅读(223) 评论(0) 推荐(0) 编辑