"topic link"Click here~~
"The main topic"
Give a rectangle, a width*hight rectangle, over the bottom edge of a point (dor,0) to do m-1 Ray, the area of the rectangle evenly divided into m parts, to find these rays and the rectangle (m-1) intersection of the coordinates
The idea of "problem solving" is given in the code:
Judging from left to right, each additional unit area state coordinates//can prove each area is a triangle # include <iostream> #include <algorithm> #include <bits/stdc ++.h>using namespace Std;const double eps=1e-6;struct node{double x, y;} Map[105];int Main () {int i,j; Double W,h,door,worker; while (~SCANF ("%lf%lf%lf%lf", &w,&h,&door,&worker), (W+h+door+worker)) {double sum=w*h; Total area double S=sum/worker; The area of each room is double res=0.0; for (i=0; i<worker-1; i++) {res+=s; if (res<= (W-door) *h/2.0)///border to the right of the coordinates {MAP[I].X=W; The area is derived high map[i].y=res*2.0/(W-door); } else if (res<= (2*w-door) *h/2.0)///border to the left of the coordinates {map[i].x=w-(Res*2.0/h-w+door); Map[i].y=h; The else//coordinates have a boundary {double ress=sum-res;//the remaining area map[i].x=0; Map[i].y=ress*2.0/door; } } for (i=0; i<worker-1; i++) {if (i) printf (""); printf ("%.3lf%.3lf", map[i].x,map[i].y); } printf ("\ n"); } return 0;}
BNU 7543 && HDU 3425 Wax (split room + analogue)