Sguia: Polymania (constructor)
Question:
Given on the plane N (3 ≤ n ≤ 8) Point, each point has a Coordinate ( Unknown ) And positive integer weight Ri , Where Rn? 1 = Rn Given a set of coordinate structures, so that the area of a triangle composed of any three points is the weight and of the three points.
Analysis:
We will consider the last two points with equal weights.
A group of structures that meet the conditions must meet the following conditions:
1. Because the weights are positive integers, there are no three-point colons;
2. The structure must be like:
Vcz1xr3Q0M/fyc + platform/fts6x2Ln9PG5vYnI + Um4/Platform + platform/Platform + UjEsUjI8L25vYnI + yc/Platform + platform/Platform + Platform keys + keys + ax47m51Oy8tL/JoaM8L3A + DQo8cD5BQyBjb2Rlo7o8L3A + DQo8cHJlIGNsYXNzPQ = "brush: java; ">#include #include typedef double DB;using namespace std;const int MAXN = 5;const DB eps = 1e-8;int n;DB a[MAXN];int main(){ #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif scanf("%d", &n); if(n > 4) puts("NO"); else { for(int i = 1; i <= n; ++i) scanf("%lf", a+i); if(n == 4) { if(fabs(a[1]+a[2]-a[3]-a[4]) > eps) { if(fabs(a[1]-a[2]) > eps) puts("NO"); else { DB x3 = -10, x4 = 10, x, y; y = (a[1]+a[3]+a[4])*2/(x4-x3); x = (a[1]+a[2]+a[3])*2/y; puts("YES"); printf("%.4lf %.4lf\n", -x/2, y); printf("%.4lf %.4lf\n", x/2, y); printf("%.4lf 0.0000\n", x3); printf("%.4lf 0.0000\n", x4); } } else { DB x3 = -10, x4 = 10, y1, y2; y1 = (a[1]+a[3]+a[4])*2/(x4-x3); y2 = -(a[2]+a[3]+a[4])*2/(x4-x3); puts("YES"); printf("0.0000 %.4lf\n", y1); printf("0.0000 %.4lf\n", y2); printf("%.4lf 0.0000\n", x3); printf("%.4lf 0.0000\n", x4); } } else { DB x2 = -10, x3 = 10, y1; y1 = (a[1]+a[2]+a[3])*2/(x3-x2); puts("YES"); printf("0.0000 %.4lf\n", y1); printf("%.4lf 0.0000\n", x2); printf("%.4lf 0.0000\n", x3); } } #ifndef ONLINE_JUDGE fclose(stdin); fclose(stdout); #endif return 0;}