전체 글

알고리즘

12739번 돌림판(small)

12739번: 돌림판 (Small) (acmicpc.net)"""12739번 돌림판(small)"""from sys import stdinN, K = map(int, stdin.readline().strip("\n").split(" "))STR = stdin.readline().strip("\n")ANSWER_COLOR = {"R": 0, "G": 0, "B": 0}for _ in range(0, K): NEW_STR = "" for i in range(0, N): PL = STR[((i - 1) + N) % N] P = STR[i] PR = STR[(i + 1) % N] COLOR = {"R": 0, "G": 0, "B": 0} ..

알고리즘

25329번 학생별 통화 요금 계산

25329번: 학생별 통화 요금 계산 (acmicpc.net)from sys import stdinN = int(stdin.readline().strip("\n"))studentDict = {}for _ in range(0, N): time, name = stdin.readline().strip("\n").split(" ") hour, minute = map(int, time.split(":")) time = hour * 60 + minute if name in studentDict: studentDict[name]["time"] += time else: studentDict[name] = {"time": time}for name in studentDi..

알고리즘

1384번 메시지

1384번: 메시지 (acmicpc.net)from sys import stdinGROUP = 1while True: N = int(stdin.readline().strip("\n")) if N == 0: exit() INFO = {} NAMELIST = [] IS_NASTY = False print("Group {0}".format(GROUP)) for i in range(0, N): STR = stdin.readline().strip("\n").split(" ") NAME = STR[0] DATA = STR[1:] NAMELIST.append(NAME) INFO[NAME] = { ..

알고리즘

17091번 단어 시계

17091번: 단어 시계 (acmicpc.net)from sys import stdin시간 = int(stdin.readline().strip("\n"))분 = int(stdin.readline().strip("\n"))시간_배열 = [ "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve",]분_배열 = [ "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"..

알고리즘

14468번 소가 길을 건너간 이유2

14468번: 소가 길을 건너간 이유 2 (acmicpc.net)from sys import stdinSTR = stdin.readline().strip("\n")A_ASCII = 65B_ASCII = 90CAW = {}for i in range(A_ASCII, B_ASCII + 1): CAW[chr(i)] = { "start": "", "end": "", }for i, value in enumerate(STR): if CAW[value]["start"] == "": CAW[value]["start"] = i else: CAW[value]["end"] = iANSWER = 0for FROM, FROM_TIME in CAW.items(..

알고리즘

1213번 팰린드롬 만들기

https://www.acmicpc.net/problem/1213

알고리즘

1212번 8진수 2진수

https://www.acmicpc.net/problem/1212 1212번: 8진수 2진수 첫째 줄에 8진수가 주어진다. 주어지는 수의 길이는 333,334을 넘지 않는다. www.acmicpc.net N = int(input(), 8) print(bin(N)[2:])

알고리즘

1173번 운동

https://www.acmicpc.net/problem/1173 1173번: 운동 첫째 줄에 다섯 정수 N, m, M, T, R이 주어진다. www.acmicpc.net from sys import exit N, m, M, T, R = map(int, input().split()) TOTAL_TIME = 0 EXERCISE_TIME = 0 health = m if health + T > M: print(-1) exit() while EXERCISE_TIME != N: if health + T M: health -= R if health < m: health = m TOTAL_TIME += 1 print(TOTAL_TIME)

beingB
느리게 올라가는 달팽이