2024/05/13 5

[Python][SWEA] 6485. 삼성시의 버스 노선 D3

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com🗒️ 파이썬 코드 풀이T = int(input())for tc in range(1,T+1) : N = int(input()) lst = [0]*5001 for _ in range(N) : A,B = map(int,input().split()) for i in range(A,B+1) : lst[i] += 1 ans = [] P = int(input()) for _ in range(P) : P_num = int(input()) ans.append(lst[P_num]) ..

[Python][SWEA] 7510. 상원이의 연속 합 D3

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com🗒️ 파이썬 코드 풀이T = int(input())for tc in range(1,T+1) : N = int(input()) cnt = 1 sum = 0 i = 2 # 연속이 되기 위한 최소 수 while True : sum += i-1 if (N-sum)  1. 해당 규칙이 있는데, 이 규칙을 코드로 풀면 된다.2개 연속  :  n + (n+1) = N   => (N-1) / 2 = n3개 연속  :  n + (n+1) + (n+2) = N    => (N - (1+2)) / 3 = n4개 연속  :  n + ..

[Python][SWEA] 4299. 태혁이의 사랑은 타이밍 D3

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com🗒️ 파이썬 코드 풀이T = int(input())for test_case in range(1, T + 1): D,H,M = map(int,input().split()) date_time = 11*60 + 11 wind_time = ((D-11)*24*60) + (H*60) + M # 날 - 시 - 분 (분으로 변환) ans = wind_time-date_time if ans  1. D의 범위가 11~14까지로 정해져있기 때문에, 11일 0시 0분 ~ "입력받은 시간" 까지를 분으로 전환해준다.(만일 D의 범위가 이전 달을 넘어가면, 다른..

[Python][SWEA] 14178. 1차원 정원 D3

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com🗒️ 파이썬 코드 풀이T = int(input())for test_case in range(1, T + 1): N,D = map(int,input().split()) min_bunmugi = N // (2*D+1) if N % (2*D+1) == 0 : print(f"#{test_case} {min_bunmugi}") else: print(f"#{test_case} {min_bunmugi+1}") 1. 문제에 수직 정원이라 되어있는데, 수평으로 해도 큰 문제가 없다. 2. 여기에서 가장 최적의 순간은 분무기가 겹치지 않고 ..

[Python][SWEA] 1961. 숫자 배열 회전

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com🗒️ 파이썬 코드 풀이def rotation(lst,N): tmp_lst = [] for j in range(N): tmp = [] for i in range(N-1,-1,-1): tmp.append(str(lst[i][j])) tmp_lst.append(tmp) return tmp_lstT = int(input())for test_case in range(1, T + 1): N = int(input()) lst_origin = [list(map(int, input().split())..