본문 바로가기

백준2352

[백준/파이썬] 8574번 Ratownik -Codefrom math import sqrtfrom sys import stdininput = stdin.readlineres = 0n, k, x, y = map(int, input().split())for _ in range(n): xi, yi = map(int, input().split()) if sqrt((xi - x) ** 2 + (yi - y) ** 2) > k: res += 1print(res) 2024. 6. 9.
[백준/파이썬] 14911번 궁합 쌍 찾기 -Codefrom itertools import combinationsnums = sorted(list(map(int, input().split())))n = int(input())res = []for com in combinations(nums, 2): if sum(com) == n and com not in res: res.append(com) print(*com)print(len(res)) 2024. 6. 8.
[백준/파이썬] 9358번 순열 접기 게임 -Codefrom collections import dequefor t in range(1, int(input()) + 1): n = int(input()) nums = deque(list(map(int, input().split()))) while len(nums) != 2: temp = deque() while nums: front = nums.popleft() if nums: back = nums.pop() temp.append(front + back) else: temp.append(front * 2) nu.. 2024. 6. 7.
[백준/파이썬] 30315번 King's Keep -Codefrom math import sqrtres = 1e9t = int(input())arr = [list(map(int, input().split())) for _ in range(t)]for i in range(t): x, y = arr[i][0], arr[i][1] temp = 0 for j in range(t): if i == j: continue x2, y2 = arr[j][0], arr[j][1] temp += sqrt((x - x2) ** 2 + (y - y2) ** 2) temp /= (t - 1) res = min(res, temp)print(res) 2024. 6. 6.
[백준/파이썬] 6139번 Speed Reading -Codefrom math import ceiln, k = map(int, input().split())for _ in range(k): s, t, r = map(int, input().split()) read = s * t res, cnt = 0, 0 while True: if n - cnt 2024. 6. 5.
[백준/파이썬] 30700번 KOREA 문자열 만들기 -Codekorea = "KOREA"s = input()res = ""for w in s: if korea[len(res) % 5] == w: res += wprint(len(res)) 2024. 6. 4.