Skip to content

Instantly share code, notes, and snippets.

@IKKO-Ohta
Created June 30, 2017 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IKKO-Ohta/613456ef3804e50c274dd453e6689d48 to your computer and use it in GitHub Desktop.
Save IKKO-Ohta/613456ef3804e50c274dd453e6689d48 to your computer and use it in GitHub Desktop.
ABC02[C].py
import math
import numpy as np
nums = [int(x) for x in input().split()]
A = (nums[0],nums[1])
B = (nums[2],nums[3])
C = (nums[4],nums[5])
alpha = np.asarray([B[0] - A[0], B[1] - A[1]])
beta = np.asarray([C[0] - A[0], C[1] - A[1]])
S = 0.5 * math.sqrt(
np.linalg.norm(alpha) ** 2 * np.linalg.norm(beta) ** 2 - alpha.dot(beta) ** 2
)
print(S)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment