http://www.lightoj.com/volume_showproblem.php?problem=1062 题意:问两条平行边间的距离,给出从同一水平面出发的两条相交线段长,及它们交点到水平面的高. 思路:计算几何怎么可能直接算出答案orz解了好久方程觉得不对,应该是二分枚举平行边的距离,通过相似三角形,算出交点的高,与题目比较,小于误差范围就行了. /** @Date : 2016-12-10-18.18 * @Author : Lweleth (SoungEarlf@gmail.c…
http://www.lightoj.com/volume_showproblem.php?problem=1137 题意:一根长度为L的杆热膨胀为L',左端点到右端点间距离不变,且膨胀后的杆的弧为圆形的一部分. 思路:由于弧度值是固定在0~PI间,所以直接二分弧度制,通过初中学的弧度公式换算一下就行了,之前精度总是达不到要求,其实eps设的更小点就行了... /** @Date : 2016-12-11-21.41 * @Author : Lweleth (SoungEarlf@gmail.c…
1062 - Crossed Ladders PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB A narrow street is lined with tall buildings. An x foot long ladder is rested at the base of the building on the right side of the street and leans on t…
Description A narrow street is lined with tall buildings. An x foot long ladder is rested at the base of the building on the right side of the street and leans on the building on the left side. A y foot long ladder is rested at the base of the buildi…
大致思路:首先对于所给的洞的点,判断是否是凸多边形,图形的输入和输出可以是顺时针或者逆时针,而且允许多点共线 Debug 了好几个小时,发现如下问题 判断三点是否共线,可用斜率公式判断 POINT point_A, point_B, point_C; if(point_A.x == point_B.x || point_B.x == point_C.x){ if(point_A.x == point_B.x && point_B.x == point_C.x) continue; }els…
专题基本全都是模版应用.贴一下模版 平面最近点对 const double INF = 1e16; ; struct Point { int x,y; int type; }; double dist(Point a,Point b) { return sqrt(1.0 * (a.x - b.x) * (a.x - b.x) + 1.0 * (a.y - b.y) * (a.y - b.y)); } Point p[MAXN]; int n,s[MAXN]; ;} ;} double close…
链接:https://cn.vjudge.net/contest/68968 POJ 2318 TOYS 题意:m个玩具落在n+1个区间,给你玩具的坐标,问每个区间有多少玩具. 思路:叉积的简单应用,用叉积判断在直线的哪一侧,因为是顺序给出坐标,所以从左往右判断即可. AC代码: #include<cstdio> #include<cmath> #include<algorithm> using namespace std; ; int U[maxn], L[maxn]…
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1507 比较简单的一题,直接对答案二分.因为对于同一组case,答案m越大,交点的高度就越小,可以从计算交点的函数中看出来.计算交点,假设mx=sqrt(sqr(x)-sqr(m)),my=sqrt(sqr(y)-sqr(m)),这两个是梯子跟两堵墙的交点.那么,交点的高度就是mx*my/(m…
提高自己的实力, 也为了证明, 开始板刷lightoj,每天题量>=1: 题目的类型会在这边说明,具体见分页博客: SUM=54; 1000 Greetings from LightOJ [简单A+B] 1001 Opposite Task  [简单题] 1002 Country Roads[搜索题] 1003 Drunk[判环] 1004 Monkey Banana Problem [基础DP] 1006 Hex-a-bonacci[记忆化搜索] 1008 Fibsieve`s Fantabu…
Area Time Limit: 1000MS Memory Limit: 10000K Description You are going to compute the area of a special kind of polygon. One vertex of the polygon is the origin of the orthogonal coordinate system. From this vertex, you may go step by step to the fol…