Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <cmath>
- using namespace std;
- const double eps = 1e-6;
- int t;
- int X1, Y1, X2, Y2, X3, Y3, X4, Y4, p;
- int Cross(int ax, int ay, int bx, int by) { return ax * by - ay * bx; }
- int main()
- {
- scanf("%d", &t);
- for (int tc = 1; tc <= t; tc++) {
- scanf("%d %d %d %d %d %d %d %d %d", &X1, &Y1, &X2, &Y2, &X3, &Y3, &X4, &Y4, &p);
- int ax = X2 - X1, ay = Y2 - Y1;
- int bx = X3 - X1, by = Y3 - Y1;
- int cx = X4 - X1, cy = Y4 - Y1;
- double res = abs((Cross(bx, by, ax, ay) + Cross(cx, cy, bx, by)) / 2.0l);
- printf("Case #%d: %.2lf\n", tc, double(p) / res + eps);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement