From 43efbcfe94d6adfe050aa27141ca7c6a7fd179f7 Mon Sep 17 00:00:00 2001 From: seongwon030 <105052068+seongwon030@users.noreply.github.com> Date: Sat, 17 Aug 2024 23:53:36 +0900 Subject: [PATCH] =?UTF-8?q?2024-08-17=207869=20=EB=91=90=20=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\221\220 \354\233\220.py" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "seongwon030/\354\210\230\355\225\231/\353\221\220 \354\233\220.py" diff --git "a/seongwon030/\354\210\230\355\225\231/\353\221\220 \354\233\220.py" "b/seongwon030/\354\210\230\355\225\231/\353\221\220 \354\233\220.py" new file mode 100644 index 0000000..b1c7014 --- /dev/null +++ "b/seongwon030/\354\210\230\355\225\231/\353\221\220 \354\233\220.py" @@ -0,0 +1,20 @@ +import math + +x1, y1, r1, x2, y2, r2 = map(float, input().split()) + +# 중심 간 거리 +d = math.sqrt((x1 - x2)**2 + (y1 - y2)**2) + + +if r1+r2 <= d: + print(format(0,".3f")) +elif abs(r1-r2) >= d : + result = math.pi*min(r1,r2)**2 + print( format(result,".3f")) +else: + t1 = math.acos((d**2+r1**2-r2**2) / (d*r1*2.0)) * 2.0 + t2 = math.acos((d**2+r2**2-r1**2) / (d*r2*2.0)) * 2.0 + + result = (t1 * r1 * r1 + t2 * r2 * r2 - r1 * r1 * math.sin(t1) - r2 * r2 * math.sin(t2)) * 0.5 + print(format(result,".3f")) +