UVA 10002 Center of Masses】的更多相关文章

题目链接:http://acm.uva.es/local/online_judge/search_uva.html Problem:Find out the center of masses of a convex polygon. Input:A series of convex polygons, defined as a number n () stating the number of points of the polygon, followed by n different pair…
题意:给出一个点集,问这个集合有没有中心点使点集对称,这个点可以是点集中的点也可以不是点集的点. 解法:一开始我枚举每两个点连线的中点……结果T了orz当时也不知道怎么想的…… 将点按横坐标排序,如果点集有中心点则中心点一定是排序后排在中间的那个点(n为奇数)或者中间两个点的连线中点(n为偶数),然后判断一下是不是中心点即可. 代码: #include<stdio.h> #include<iostream> #include<algorithm> #include<…
uva 1444 Description   You are in a library equipped with bookracks that move on rails. There are many parallel rails, i.e., the bookracks are organized in several rows, see figure: The boockracks in the library. There is no passage to the librarian…
题意: 有一种奇怪的电梯,每次只能向上走u个楼层或者向下走d个楼层 现在有m个这种电梯,求恰好n次能够到达的最小楼层数(必须是正数),最开始默认位于第0层. 分析: 假设电梯向上走x次,则向下走n-x次,则所到达的楼层为xu - (n-x)d ≥ 0 (u+d)x ≥ nd,x的最小值为 换句话说,如果nd % (u+d) == 0, x = nd / (u+d) 否则 x = nd / (u+d) + 1 考虑到不能停到0楼的条件:当nd % (u+d) == 0会出现这种情况,所以只能多上一…
https://vjudge.net/problem/UVA-1648 设上升x层,列个方程解出来,再把x带回去 #include<cmath> #include<cstdio> #include<iostream> #include<algorithm> using namespace std; ],d[]; int main() { int n,m,ans,x; while(scanf("%d%d",&n,&m)!=E…
1.LA 5694 Adding New Machine 关键词:数据结构,线段树,扫描线(FIFO) #include <algorithm> #include <cstdio> #include <cstring> #include <string> #include <queue> #include <map> #include <set> #include <ctime> #include <cm…
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2346 数位DP 代码: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <cmath> #include <…
10798 - Be wary of Roses You've always been proud of your prize rose garden. However, some jealous fellow gardeners will stop at nothing to gain an edge over you. They have kidnapped, blindfolded, and handcuffed you, and dumped you right in the middl…
UVa 10382 - Watering Grass n sprinklers are installed in a horizontal strip of grass l meters long and w meters wide. Each sprinkler is installed at the horizontal center line of the strip. For each sprinkler we are given its position as the distance…
Dumb Bones UVA - 10529   来自绿书p176  题意 你试图把一些多米诺骨牌排成直线,然后推倒它们.但是如果你在放骨牌的时候不小心把刚放的骨牌碰倒了,它就会把相临的一串骨牌全都碰倒,而你的工作也被部分的破坏了. 比如你已经把骨牌摆成了DD__DxDDD_D的形状,而想要在x这个位置再放一块骨牌.它可能会把左边的一块骨牌或右边的三块骨牌碰倒,而你将不得不重新摆放这些骨牌. 这种失误是无法避免的,但是你可以应用一种特殊的放骨牌方法来使骨牌更多的向一个方向 分析 首先应该明确怎样…