[백준] 2166번 : 다각형의 면적 - Python(파이썬)

강재원·2022년 10월 25일
0

[코딩테스트] Python

목록 보기
150/200



https://www.acmicpc.net/problem/2166

n=int(input())
num=0
x1,y1=map(int,input().split())
x0=x1
y0=y1
for i in range(n-1):
    x2,y2=map(int,input().split())
    num+=x1*y2-x2*y1
    if i==n-2: num+=x2*y0-x0*y2
    x1=x2
    y1=y2
print("%.1f" % (abs(num)/2.0))
profile
개념정리 & 문법 정리 & 알고리즘 공부

0개의 댓글