![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM
Zackory
这个作者很懒,什么都没留下…
展开
-
2017 ACM-ICPC Problem A. Chat Group
It is said that a dormitory with 6 persons has 7 chat groups ^_^. But the number can be even larger: since every 3 or more persons could make a chat group, there can be 42 different chat groups. Give...原创 2018-05-14 21:18:46 · 720 阅读 · 0 评论 -
大容量背包问题 Herbs Gathering
Collecting one’s own plants for use as herbal medicines is perhaps one of the most self-empowering things a person can do, as it implies that they have taken the time and effort to learn about the use...原创 2018-08-14 20:23:34 · 534 阅读 · 0 评论 -
Ants
题目链接 题目大意:有2*n个点,其中有n只蚂蚁,n棵树,树和蚂蚁分别一 一对应,并且连线不会有交叉,求出连线的方式。 注意:样例有误。 解题思路:定义一个结构体,包含着坐标信息,类别信息,蚂蚁和树的对应信息。蚂蚁为1,树为-1。每一个实体标记当前序号k(1~2*n)。 1:从1到2*n开始坐标排序,记录第一个节点(详情看紫书)。 2:通过角度排序整个[l+1,r]的点。 3:由于开始...原创 2018-07-28 10:10:55 · 355 阅读 · 0 评论 -
UVa 1354 天平难题
题目链接 题目大意:给出房间的宽度r和s个挂坠的重量,设计一个尽量宽(但不超过房间的宽度r)的天平。 解决问题点:由于节点的数目少,可以将整个天平(当作二叉树)枚举出来,然后计算宽度(实际上在构造二叉树的时候就可以计算),要注意左子树的宽度可能会大于根节点的做宽度,通过比较计算。 #include<iostream> #include<cstring> #incl...原创 2018-07-27 16:19:23 · 283 阅读 · 0 评论 -
Aggressive cows
Aggressive cows 此题也是二分法,做法是先将输入的所有坐标排序,分别设置最小的距离为一,最大的距离为从最大的到最小的距离,对距离进行二分,找到最合适的那一个。 合适为满足距离的间隔恰好为C-1个; #include<iostream> #include<cstdio> #include<cstdlib> #include<cstri...原创 2018-07-25 16:42:01 · 268 阅读 · 0 评论 -
Cable master
Cable master 此题主要是应用二分法解题,尤其要注意精度上的问题,在每个输入数据的前面加上0.005,来补充在运算输出时的损失问题。 #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> using na...原创 2018-07-25 15:27:01 · 2220 阅读 · 1 评论 -
A Bug's Life
A Bug’s Life 此题的题意是分别给出多组数据,每组数据是不同的性别,让你分析是否给出的数据中存在相同的性别,输出指定的语句。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int pre[2009]; int enemy[2009]; ...原创 2018-07-25 14:32:27 · 822 阅读 · 0 评论 -
poj A
题目链接 #include<iostream> #include<cstring> #include<cstdio> using namespace std; const int maxn=10000; int p[maxn]; int vis[maxn]; int R[maxn]; void init() { for(int i=0; i<=...原创 2018-07-18 19:49:04 · 211 阅读 · 0 评论 -
poj B
题目链接 #include<iostream> #include<cstdio> #include<cstring> #include<vector> #include<cmath> using namespace std; const int maxn=1010; struct node { int x,y; }N[max...原创 2018-07-18 19:47:22 · 211 阅读 · 0 评论 -
poj C
题目链接 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int maxn=50005; int pre[maxn],vis[maxn]; int find(int x) { int r=x; while(r!=pre[r])...原创 2018-07-18 19:45:39 · 353 阅读 · 0 评论 -
poj E
题目链接 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int maxn=200000; int pre[maxn]; int enemy[maxn]; int find(int x) { return pre[x]==x?x:fi...原创 2018-07-18 19:43:26 · 103 阅读 · 0 评论 -
hdu 3038
题目链接 关于并查集系列问题的解法链接 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; const int maxn=200010; int pre[maxn]; int sum[maxn]; int find...原创 2018-07-23 20:26:16 · 226 阅读 · 0 评论 -
计蒜客 计蒜之道 第二场 A.淘宝的推荐系统
小明刚刚入职淘宝,老大给他交代了一个简单的任务,实现一个简易的商品推荐系统。 这个商品推荐系统的需求如下: 一共有n件商品可以被推荐,他们的编号分别为 1到n。每件商品都有一个价格,编号为i 的商品价格为 pi元。现在需要给用户推荐尽可能多的商品,但是要保证按照编号上升的顺序给用户依次推荐商品,并且,相邻商品的价格之差的绝对值不能超过d。注意,第一个推荐的商品价格没有限制。 输入格式 第一...原创 2018-05-15 20:23:29 · 217 阅读 · 0 评论 -
HDU - 1175 连连看 dfs+剪枝
题目链接————连连看 #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> using namespace std; int n,m,Map[1005][1005],vis[1005][1005]; int dir[4][2]={1,0,-1,0...原创 2018-08-14 21:31:15 · 115 阅读 · 0 评论