로봇 - Python, 구현
출처 : https://www.acmicpc.net/problem/13901 코드 import sys# 입력 처리data = sys.stdin.read().splitlines()R, C = map(int, data.pop(0).split(" "))room = [[False] * C for _ in range(R)]# 장애물 설치k = int(data.pop(0))for _ in range(k): br, bc = map(int, data.pop(0).split(" ")) room[br][bc] = Truer, c = map(int, data.pop(0).split(" "))commands = list(map(int, data.pop(0).split()))# 1 : up, 2 : down, 3 ..
2025. 3. 26.
파이썬 자주 사용하는 라이브러리 모음 - 코테 꿀팁
1. mathimport mathprint(math.factorial(5)) # 5! = 120print(math.gcd(36, 60)) # 최대공약수(GCD) = 12print(math.sqrt(25)) # 제곱근 = 5.0print(math.ceil(3.1)) # 올림 = 4print(math.floor(3.9)) # 내림 = 32. itertoolsimport itertoolsarr = [1, 2, 3]# 순열 (3개 중 2개를 선택하는 모든 경우) -> 순서 의미 있음print(list(itertools.permutations(arr, 2)))#[(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)]# 조합 (3개 중 2개를 뽑는 경우) -> 순서 ..
2025. 3. 22.