結果

問題 No.1447 Greedy MtSaka
ユーザー 👑 rin204rin204
提出日時 2021-08-23 05:25:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2024-04-24 20:10:12
合計ジャッジ時間 1,839 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,840 KB
testcase_01 AC 39 ms
51,968 KB
testcase_02 AC 37 ms
51,840 KB
testcase_03 AC 36 ms
51,968 KB
testcase_04 AC 36 ms
52,096 KB
testcase_05 AC 36 ms
51,840 KB
testcase_06 AC 37 ms
51,840 KB
testcase_07 AC 36 ms
51,712 KB
testcase_08 AC 35 ms
52,096 KB
testcase_09 AC 36 ms
51,840 KB
testcase_10 AC 36 ms
51,840 KB
testcase_11 AC 35 ms
51,840 KB
testcase_12 AC 36 ms
51,968 KB
testcase_13 AC 36 ms
51,840 KB
testcase_14 AC 34 ms
51,968 KB
testcase_15 AC 36 ms
51,840 KB
testcase_16 AC 34 ms
51,968 KB
testcase_17 AC 37 ms
51,840 KB
testcase_18 AC 34 ms
51,712 KB
testcase_19 AC 35 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

ans = 0
x0, y0 = xy[0]
for i in range(1, n - 1):
    x1, y1 = xy[i]
    x2, y2 = xy[i + 1]
    dx1 = x1 - x0
    dy1 = y1 - y0
    dx2 = x2 - x0
    dy2 = y2 - y0
    ans += abs(dx1 * dy2 - dy1 * dx2)
print(ans)

0