Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int square(int a1, int a2, int b1, int b2)
- {
- return (fabs(a1 * b2 - a2 * b1));
- }
- int main()
- {
- int a1, a2, b1, b2, c1, c2;
- int x1, x2;
- scanf("%d %d %d %d %d %d", &a1, &a2, &b1, &b2, &c1, &c2);
- scanf("%d %d", &x1, &x2);
- int right_answer = square (b1 - a1, b2 - a2, c1 - a1, c2 - a2);
- int check_answer = square (b1 - a1, b2 - a2, x1 - a1, x2 - a2);
- check_answer += square (c1 - b1, c2 - b2, x1 - b1, x2 - b2);
- check_answer += square (a1 - c1, a2 - c2, x1 - c1, x2 - c2);
- if (right_answer == 0 && check_answer == 0)
- {
- if (sqrt((x1 - a1) * (x1 - a1) + (x2 - a2) * (x2 - a2)) + sqrt((x1 - b1) * (x1 - b1) + (x2 - b2) * (x2 - b2)) == sqrt((b1 - a1) * (b1 - a1) + (b2 - a2) * (b2 - a2)))
- {
- printf("In");
- return 0;
- }
- if (sqrt((x1 - a1) * (x1 - a1) + (x2 - a2) * (x2 - a2)) + sqrt((x1 - c1) * (x1 - c1) + (x2 - c2) * (x2 - c2)) == sqrt((c1 - a1) * (c1 - a1) + (c2 - a2) * (c2 - a2)))
- {
- printf("In");
- return 0;
- }
- if (sqrt((x1 - b1) * (x1 - b1) + (x2 - b2) * (x2 - b2)) + sqrt((x1 - c1) * (x1 - c1) + (x2 - c2) * (x2 - c2)) == sqrt((c1 - b1) * (c1 - b1) + (c2 - b2) * (c2 - b2)))
- {
- printf("In");
- return 0;
- }
- printf("Out");
- return 0;
- }
- if (check_answer == right_answer)
- printf("In");
- else
- printf("Out");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement