Skip to content

Commit c4bffa9

Browse files
authored
[BOJ] 2166 다각형의 면적 (G5)
1 parent c819e8d commit c4bffa9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

김지호/5주차/260126.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://www.acmicpc.net/problem/2166
2+
3+
import sys
4+
5+
sys.stdin = open("./input.txt",'r')
6+
7+
N = int(input())
8+
coordinates = []
9+
10+
for _ in range(N):
11+
coordinates.append(list(map(int,input().split(' '))))
12+
coordinates.append(coordinates[0])
13+
14+
answer = 0
15+
for i in range(N):
16+
answer += (coordinates[i][0] * coordinates[i+1][1]) - (coordinates[i+1][0]*coordinates[i][1])
17+
18+
print(abs(answer)/2)

0 commit comments

Comments
 (0)