[coding test] Baekjoon_level 9_기본 수학 2-3
2021. 6. 6. 02:00ㆍPython/코딩 테스트
Ver. Jupyter Notebook (Anaconda3)
▶ coding test_Baekjoon_level 9_기본 수학 2-3
- 백준: baekjoon
- 코딩 및 결과: github
JeongJaeyoung0/coding_test
코딩테스트. Contribute to JeongJaeyoung0/coding_test development by creating an account on GitHub.
github.com
- math.pi: π(파이)
>>> import math
>>> math.pi
- 부동실수 오차
>>> 0.1+0.2
Out: 0.30000000000000004
>>> 0.1+0.2==0.3
Out: False
>>> import decimal
>>> decimal.Decimal('0.1')+decimal.Decimal('0.2')==decimal.Decimal('0.3')
Out: True
2021.06.06
# coding test_Baekjoon_level 9_기본 수학 2-3
# 4153 (직각삼각형)-1
a=sorted(list((map(int,input().split()))))
while sum(a)!=0:
if a[0]**2+a[1]**2==a[2]**2:print('right')
else:print('wrong')
a=sorted(list((map(int,input().split()))))
# 4153 (직각삼각형)-2
a=1
while a:a,b,c=sorted(map(int,input().split()));a>0==print('rwirgohntg'[a*a+b*b!=c*c::2])
# 3053 (택시 기하학)-1
import math
r=int(input())
print(r*r*math.pi,2*r*r)
# 3053 (택시 기하학)-2
r=int(input())**2;print(r*3.14159265359,r*2)
# 1002 (터렛)-1
for _ in range(int(input())):
x,y,r,a,b,c=map(int,input().split())
d=(((x-a)**2)+((y-b)**2))**.5
if x==a and y==b and r==c:print(-1)
elif d==r+c or d==abs(r-c):print(1)
elif r+c<d or d<abs(r-c) or d==0:print(0)
else:print(2)
# 1002 (터렛)-2
exec('x,y,r,a,b,c=map(int,input().split());d=((x-a)**2+(y-b)**2)**.5;print(-1if d==0and r==c else 1if d==r+c or d==abs(r-c) else 0if r+c<d or d<abs(r-c) or d==0else 2);'*int(input()))
'Python > 코딩 테스트' 카테고리의 다른 글
[coding test] Baekjoon_level 10_재귀-2 (0) | 2021.06.08 |
---|---|
[coding test] Baekjoon_level 10_재귀-1 (0) | 2021.06.07 |
[coding test] Baekjoon_level 9_기본 수학 2-2 (0) | 2021.06.05 |
[coding test] Baekjoon_level 9_기본 수학 2-1 (0) | 2021.06.04 |
[coding test] Baekjoon_level 8_기본 수학 1-2 (0) | 2021.06.02 |