파이썬2327 [백준/파이썬] 18110번 solved.ac -Codefrom sys import stdininput = stdin.readlinedef round_sol(num): return int(num + 0.5)n = int(input())if n: cut = round_sol(n * 0.15) level = sorted([int(input()) for _ in range(n)])[cut:n-cut] print(round_sol(sum(level) / (n - 2 * cut)))else: print(0)처음에 문제를 잘못이해해서 틀리고 이후 문제가 생겨서 찾아보니 round 문제로 인해 한번 더 틀렸습니다. 추가로 배열 범위도 실수해서 좀 많이 시도했습니다. 2025. 6. 9. [백준/파이썬] 7366번 Counting Sheep -Codefor t in range(1, int(input()) + 1): n = int(input()) s = list(input().split()) print(f"Case {t}: This list contains {s.count('sheep')} sheep.") print() 2025. 6. 8. [백준/파이썬] 29415번 Треугольник -Codefrom math import sqrts = int(input())extent = 2 * sres = 0for a in range(1, int(sqrt(extent)) + 1): if extent % a == 0: b = extent // a if a > b: break c_pow = a * a + b * b c = int(sqrt(c_pow)) if c * c == c_pow: res += 1print(res) 2025. 6. 7. [백준/파이썬] 15874번 Caesar Cipher -Codek, l = map(int, input().split())s = input()alpa_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"alpa_lower = alpa_upper.lower()res = ""for ch in s: # 소문자인 경우 if ch.islower(): idx = (alpa_lower.index(ch) + k) % 26 res += alpa_lower[idx] # 대문자인 경우 elif ch.isupper(): idx = (alpa_upper.index(ch) + k) % 26 res += alpa_upper[idx] # 알파벳이 아닌 경우 else: res += .. 2025. 6. 6. [백준/파이썬] 13304번 방 배정 -Codefrom math import ceiln, k = map(int, input().split())students = [0] * 5for _ in range(n): s, y = map(int, input().split()) if y == 1 or y == 2: students[0] += 1 elif s == 0 and (y == 3 or y == 4): students[1] += 1 elif s == 1 and (y == 3 or y == 4): students[2] += 1 elif s == 0 and (y == 5 or y == 6): students[3] += 1 else: students[4] +=.. 2025. 6. 5. [백준/파이썬] 32307번 Injured Shoulder -Code# 중복 제거를 위한 setword_set = set()for _ in range(int(input())): word_set.add(input())# 이후 입력을 받음for _ in range(int(input())): word = input() # 입력 단이가 단어 리스트에 있는 경우 if word in word_set: print(1) else: flag = False for word2 in word_set: # 단어 2개를 합친 것인지 판단 if word.startswith(word2): temp = word[len(word2):] i.. 2025. 6. 4. 이전 1 2 3 4 5 6 7 8 ··· 388 다음