-
[🐉 백준 9단계] 수학 2Algorithm/케로베로스 2020. 12. 13. 22:55반응형
백준 9단계
수학 2
1978
n=input() l=list(map(int, input().split())) answer = 0 for i in l: count = 0 for j in range(1, i+1): if i == 1: break if i%j == 0: count += 1 if count == 2: answer += 1 print(answer)
2581
import math while True: n = int(input()) if n == 0: break count = 0 for i in range(n+1, 2*n+1): if i == 1: continue elif i == 2: count += 1 continue else: for j in range(2, int(math.sqrt(i))+1): if i%j == 0: break else: count += 1 print(count)
1929
def sosu(n): import math for i in range(2, int(math.sqrt(n))+1): if n%i == 0: return False return True m, n = map(int, input().split()) for i in range(m, n+1): if i == 1: continue if sosu(i) == True: print(i)
4948
import math def IsPrime(num): a = int(math.sqrt(num)) if num == 1: return False else: for i in range(2, a+1): if num % i == 0: return False return True Num_list = list(range(2,246912)) Sort_list = [] for i in Num_list: if IsPrime(i): Sort_list.append(i) while True: n = int(input()) if n == 0: break cnt = 0 for i in Sort_list: if n < i <= n*2: cnt += 1 print(cnt)
9020
ch=[0]*10001 sosu=[0]*10001 for i in range(2,10001): if ch[i]==0: sosu[i]=i for j in range(i,10001,i): ch[j]=1 n=int(input()) for _ in range(n): i=int(input()) left=i//2 while left>1: right=i-left if sosu[left]>0 and sosu[right]>0: res=[sosu[left], sosu[right]] break else: left-=1 print(res[0], res[1])
1085
x, y, w, h = list(map(int,input().split())) print(min([x, y, w-x, h-y]))
3009
xl = [] yl = [] for _ in range(3): x,y = map(int,input().split()) if x in xl: xl.remove(x) else: xl.append(x) if y in yl: yl.remove(y) else: yl.append(y) print(xl[0], yl[0])
4153
while True: l = list(map(int, input().split())) h = max(l) l.remove(h) x = l[0] y = l[1] if x == 0 and y == 0 and h == 0: break if x**2 + y**2 == h**2: print('right') else: print('wrong')
3053
pi = 3.14159265359 r = int(input()) print(pi*(r**2)) print(2*(r**2))
1002
test = int(input()) for _ in range(test): x1, y1, r1, x2, y2, r2 = map(int, input().split()) distance = (((x1 - x2) ** 2) + ((y1 - y2) ** 2)) ** 0.5 if x1 == x2 and y1 == y2: if r1 == r2: print(-1) else: print(0) continue if r1 > distance + r2 or r2 > distance + r1 or distance > r1 + r2: print(0) elif r1 == distance + r2 or r2 == distance + r1 or r1 + r2 == distance: print(1) else: print(2)
반응형'Algorithm > 케로베로스' 카테고리의 다른 글
[🐉 백준 10단계] 재귀 (0) 2020.12.21 [🦩 프로그래머스] 오픈채팅방 / 나누어 떨어지는 숫자배열 / 같은 숫자는 싫어 / 체육복 (0) 2020.12.14 [🐉 백준 8단계] 수학 1 (2) 2020.12.13 [🐉 백준 7단계] 문자열 (0) 2020.12.12 [🦩 프로그래머스] 타겟넘버 / 모의고사 / 크레인 인형뽑기 게임 / K번째 수 (0) 2020.12.06