Problem - 3982 题意就是给出一个圆心在原点半径为R的圆形蛋糕,上面有一个cherry,对蛋糕切若干刀,最后要求求出有cherry的那块的面积占整个蛋糕的多少. 做法显而易见,就是一个半平面交,将有向直线的方向根据cherry的位置确定好,然后就进行半平面交,得到一个多边形. 再将多边形用之前几个代码的圆与多边形交,求出区域的大小,再除以整个蛋糕的面积即可. 注意,这样做的时候,精度是要用1e-6或者是1e-4,太高了反而过不了数据. ——written by Lyon…
Problem - 2892 这道题的做法是以圆心为原点,对多边形进行三角剖分.题目描述中,多边形的可能是顺时针或者是逆时针给出,不过在我的做法里,是用有向面积来计算的,和常见的多边形面积的求法类似,不过就是多了三角形与圆交的情况.三角形于圆交的情况共三种(因为这里的三角形其中一个点是圆心,另外两个点是多边形上相邻的两个顶点,所以我们只考虑多边形的边与圆相交的情况):与多边形的边(一条线段)没有交点,一个交点,两个交点. 敲这份代码最大的问题是敲的过程中有很多小错误,导致最后花了将近小时来deb…
The area Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7066 Accepted Submission(s): 4959 Problem Description Ignatius bought a land last week, but he didn't know the area of the land because the…
Counting Squares Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1885 Accepted Submission(s): 946 Problem Description Your input is a series of rectangles, one per line. Each rectangle is sp…
思路:海伦公式, AC代码: #include<bits/stdc++.h> using namespace std; int main() { int n; scanf("%d",&n); double ha, hb, hc, a, b, c; while(~scanf("%lf %lf %lf",&ha,&hb,&hc)) { a = 2.0 / ha; b = 2.0 / hb ; c = 2.0 / hc; if(…
链接:https://www.nowcoder.com/acm/contest/141/J来源:牛客网 Eddy has graduated from college. Currently, he is finding his future job and a place to live. Since Eddy is currently living in Tien-long country, he wants to choose a place inside Tien-long country…