diff --git a/froglike6/README.md b/froglike6/README.md index d979d30..09ec996 100644 --- a/froglike6/README.md +++ b/froglike6/README.md @@ -10,4 +10,5 @@ | 6차시 | 2025.04.07 | 백트래킹| [N-Queen](https://www.acmicpc.net/problem/9663)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/24| | 7차시 | 2025.04.09 | 그래프 | [최소비용 구하기](https://www.acmicpc.net/problem/1916)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/27| | 8차시 | 2025.04.11 | 물리학 | [곰곰이와 시소](https://www.acmicpc.net/problem/26072)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/31| + | 9차시 | 2025.04.30 | 기하학 | [평행사변형](https://www.acmicpc.net/problem/1064)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/34| --- diff --git a/froglike6/geometry/1064.py b/froglike6/geometry/1064.py new file mode 100644 index 0000000..c539293 --- /dev/null +++ b/froglike6/geometry/1064.py @@ -0,0 +1,26 @@ +import math +import sys +input = sys.stdin.readline + +def main(): + xA, yA, xB, yB, xC, yC = map(int, input().split()) + + cross = (xB - xA) * (yC - yA) - (yB - yA) * (xC - xA) + if cross == 0: + print(-1) + return + + dAB = math.hypot(xA - xB, yA - yB) + dBC = math.hypot(xB - xC, yB - yC) + dCA = math.hypot(xC - xA, yC - yA) + + s1 = dAB + dCA + s2 = dAB + dBC + s3 = dBC + dCA + + answer = 2 * (max(s1, s2, s3) - min(s1, s2, s3)) + + print(f"{answer:.15f}") + +if __name__=="__main__": + main() \ No newline at end of file