본문 바로가기

전체 글3054

[백준/파이썬] 4580번 Mad Scientist -Codewhile True: line = list(map(int, input().split())) # 0만 입력시 종료 if line[0] == 0: break # 사용 갯수 n = line[0] # 사용할 리스트 li = line[1:] # 결과 res = [] # 현재 값 now = 1 # 리스트 원소에 맞는 갯수 만큼 값 삽입 for el in li: for _ in range(el - len(res)): res.append(now) now += 1 print(*res) 2025. 5. 1.
[백준/파이썬] 33653번 Search Wizard -Codes = input()n = int(input())s_list = list(input().split())res = 0for el in s_list: for i in range(len(el) - len(s) + 1): if el[i:i + len(s)] == s: res += 1print(res) 2025. 5. 1.
[백준/파이썬] 29342번 Война клонов -Coden = int(input())a_list = list(map(int, input().split()))even = len([el for el in a_list if el % 2 == 0])odd = n - evenprint(even * odd) 2025. 4. 29.
[백준/파이썬] 29575번 Игровой автомат -Coden = int(input())# 점수 얻는 숫자들 저장jackpot = {}for _ in range(n): c, w = map(int, input().split()) jackpot[c] = w# 결과 저장res = 0# 슬롯 돌리기m = int(input())for _ in range(m): num = int(input()) # 숫자가 잭팟인 경우 if num in jackpot: res += jackpot[num] res -= 10print(res) 2025. 4. 28.
[백준/파이썬] 33772번 Wow -Coden = int(input())total = [input() for _ in range(2)]dot_cnt, flag, res = 0, False, ""for el in total[1][3:]: if el == '.': dot_cnt += 1 elif el == '\\': if dot_cnt == 2: flag = True elif dot_cnt == 3: res += "w" if flag else "v" flag = False dot_cnt = 0res += "w" if flag else "v"print(res) 2025. 4. 27.
[백준/파이썬] 31496번 자작나무가 없소~ -Codefrom sys import stdininput = stdin.readlinen, item = input().split()n = int(n)res = 0for _ in range(n): name, cnt = input().split() name_arr = name.split("_") if item in name_arr: res += int(cnt)print(res) 2025. 4. 26.