50114. Simple Polygon

難度:1/5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>

typedef struct{
int x;
int y;
}pt;

int main(){
pt a, b, c, d;
scanf("%d %d %d %d %d %d %d %d", &a.x, &a.y, &b.x, &b.y, &c.x, &c.y, &d.x, &d.y);

int area = 0;
area += (b.x - a.x) * (b.y - a.y);
area += (c.x - a.x) * (d.y - b.y);
area += (c.x - d.x) * (c.y - d.y);

int per = 0;
per += 2 * (c.x - a.x + c.y - a.y);
printf("%d\n%d\n", per, area);
}


50114. Simple Polygon
https://aaronlin1229.github.io/judgegirl_50114/
Author
Akizumi
Posted on
July 17, 2023
Licensed under