The idea of the problem is very good to think, divided into the following 4 steps:1: Seek the radius of the circumscribed garden2: Ask for three central angle3: Find the greatest common divisor of three center angle4: Greatest Common divisor is the largest regular polygon internal angle, to find the area can be.But every step does not beg ah .... Sad ... When I think of the 3rd step, I even feel that I should ask for it in another way. To change the method. The
the cross product: 1: The result is that A and B form the parallelogram area of the adjacent edge. 2: The result has a positive negative, there is a sin (a, b) and its angle, the angle is greater than 180 ° is negative. 3: Cross product does not meet the Exchange lawApplication: (1: Through the results of positive and negative judgment between the two vectors of the cis-counterclockwise relationship if a X B > 0 means a in the clockwise direction of b if a x B (2: Judge the zigzag turn, can be
, and the collinear returns True { //idea: Judging the cross product, whether the coefficients are 0 return(Y*A.Z-Z*A.Y) = =0 (z*a.x-x*a.z) = =0 (x*a.y-y*a.x) = =0; } cooroperator^ (coor a)Const //get the cross product of two vectors (that is, the vector product) and return a vector (coordinate) { returnCoor (y*a.z-z*a.y,z*a.x-x*a.z,x*a.y-y*a.x); } cooroperator-(Coor a)Const //if it's c-d, get the vector DC, { returnCoor (x-a.x,y-a.y,z-a.z); } int operator
(Point_line_dis (P[pos],lq[i]) >point_line_dis (p[pos-1],lq[i]) pos==1? pos=n:pos--; -ans=min (Ans,point_line_dis (p[pos],lq[i)); - } A } + the intMain () { - while(SCANF ("%d%d", n,m)! =EOF) { $ans=inf; the if(n==0 m==0) Break; the for(intI=1; i"%LF%LF",p[i].x,p[i].y); the for(intI=1; i"%LF%LF",q[i].x,q[i].y); thep[n+1]=p[1],q[m+1]=q[1]; - for(intI=1; i from=p[i],lp[i].to=p[i+1]; in for(intI=1; i from=q[i],lq[i].to=q[i+1]; the Solvep (); the
Bzoj 1580Calculate the time of each segment directly and then simulate1#include 2#include 3#include 4#include 5#include 6#include 7#include 8 #definePa pair9 #defineMP Make_pairTen #definePB Push_back One #defineSe Second A #defineFi first - - using namespacestd; the Const intmaxn=50100; - Const intinf=0x3f3f3f3f; - intN,r,x,y,vx,vy,p[maxn],q[maxn],vp[maxn],vq[maxn],ans; -VectorV; +InlineintSQR (intx) {returnx*x;} -InlineDoubleMax (DoubleXDoubleY) {returnX>y?x:y;} + intMain () A { at //fre
and no three points lie in a same line. the coordinate of the point is in the range [-10086,10086].
1
Output
For each case, output the case number first, and then output the number of different convex quadrilateral in the sky. Two convex quadrilaterals are considered different if they lie in the different position in the sky.
Sample Input 2
4
0 0
100 0
0 100
100 100
4
0 0
100 0
0 100
10 10
Sample output Case 1: 1
Case 2: 0
This is a question for calculating the number of convex qua
The legend does CF does not fill the question equal to did not do so the first time to fill ... This time CF did not make the description of De D The magic to now also did not understand so only to fill the EEach div2 is hack before two or three questions finally hit a hack after the third question ... Hope that the future will be better and sooner. At least become a blue name:)E Test instructions There's a cockroach who's going to kill it gives the cockroach the coordinates of the speed of the
box. Even if Reza keeps throwing his toys to the box, at least toys, then get thrown into different partitions stay separate. The box looks like this from the top:
We want for each positive integer t, such this there exists a partition with T-toys, determine how many partitions has T, Toys.InputThe input consists of a number of cases. The first line consists of six integers n, m, x1, y1, x2, y2. The number of Cardboards to form the partitions is n (0 A line consisting of a single 0 termin
This is the first time I can do so, the title of the precision range is large, so you can use the circular area directly with a small square stitching approximation to indicate that maps open the larger, more accurate, but also time-consuming and more.The code is as follows:#include #include#includeusing namespacestd;intMain () {DoubleX,y,r; intmaps[101][101],num,i,j,n; while(~SCANF ("%d",N)) {num=10201; memset (Maps,0,sizeof(maps)); for(intK =0; k ) {scanf ("%LF%LF%LF",x,y,R); X=x* -+ -; Y=y*
:2.250778Test Instructions: Find the area where two rings intersect;Ideas: ans= two large circle area intersection + two small round area intersection -2* Big circle with small round area intersection;AC Code:#include #include#include#include#includeusing namespaceStd;typedefLong LongLL;Const intn=1e5+6;ConstLL mod=1e9+7;Const DoublePi=acos (-1.0);DoubleFunDoubleXDoubleYDoubleFxDoubleFyDoubleRDoubleR) {DoubleDis=sqrt ((X-FX) * (X-FX) + (y-fy) * (yfy)); //cout if(DISGT;=R+R)return 0; Else
Test instructions: Given some line segments, ask if you can find a line that crosses all segmentsIdea: If there is a straight line, then there must be a straight line is over the existing two points, then enumerate two points, and then to determine whether the intersection with all the segments can beCode:#include POJ 3304 Segments (computational geometry)
Use the cross product to determine whether the point is on the left or right side of the segment, then two points can beCode:#include POJ 2318 TOYS (computational geometry)
entered. You is to write a program which determines this minimum number of doors.An example is shown below:
InputThe input would consist of one case. The first line would be a integer n (0 OutputPrint a single line listing the minimum number of doors which need to is created, in the format shown below.Sample InputSample OutputSourceEast Central North America 1999
Test instructions: There are some staggered inner walls inside a square fence, the inner wall ends are on a
to avoid floating-point arithmetic, the square root 2 is about to drop, the code of side length actually refers to side length/square root 2, can alsoThe problem is understood as projecting the square onto the x-axis.#include #includestring.h>#include#includeusing namespacestd;structsa{intL,r,len;} data[ -];intMain () {intN; while(cin>>nN) {memset (data,0,sizeof(data)); for(intI=0; i) {cin>>Data[i].len; for(intj=0; j) DATA[I].L=max (Data[i].l,data[j].r-abs (data[i].len-Data[j].len)); /Seek t
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.