본문 바로가기
728x90

코딩테스트/softeer9

[python] Level2_바이러스 https://softeer.ai/practice/info.do?idx=1&eid=407&sw_prbl_sbms_sn=117912 Softeer 연습문제를 담을 Set을 선택해주세요. 취소 확인 softeer.ai 이 문제는 좀 짚고 넘어가야 하는게 있습니다. 단순한 거듭제곱에 대한 문제인데 for 문이나 pow함수로 거듭제곱을 표현한다면 시간복잡도가 O(n)이 됩니다. 이를 해결하기 위해서는 pow함수 자체를 알아보았다. - pow함수 자체에 대한 개념 https://deok2kim.tistory.com/88 [python] pow, 제곱, 거듭제곱과 나머지 📗 파이썬에서 거듭제곱과 나머지를 구할 때! 속도 차이 🔵 pow(a,b) vs a**b 100의 100승을 구할 때 입력 방법 속도 100**1.. 2023. 1. 4.
[python] Level2_GBC https://softeer.ai/practice/info.do?idx=1&eid=584&sw_prbl_sbms_sn=117856 Softeer 연습문제를 담을 Set을 선택해주세요. 취소 확인 softeer.ai 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 import sys # sys.stdin = open("input3.txt",'r') n,m = map(int,sys.stdin.readline().split()) #빈 딕셔너리 생성 n_dict .. 2023. 1. 4.
[python] Level2_회의실 예약 https://softeer.ai/practice/info.do?idx=1&eid=626 Softeer 연습문제를 담을 Set을 선택해주세요. 취소 확인 softeer.ai 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 import sys #sys.stdin = open("input1.txt","r") # n:회의실 수, m:예약된 회의의 수 n,m = map(int,sys... 2023. 1. 3.
[python] Level2_비밀 메뉴 https://softeer.ai/practice/info.do?idx=1&eid=623&sw_prbl_sbms_sn=116899 Softeer 연습문제를 담을 Set을 선택해주세요. 취소 확인 softeer.ai 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import sys #sys.stdin = open("input.txt","r") # m:정답, n: 숫자열, k: k이하 정수 m,n,k = map(int,input().split()) m_array = list(map(int,input().split())) n_array = list(map(int,input().split())) #print(m_array,n_array) if len(.. 2023. 1. 3.
[python] Level2_지도 자동 구축 https://softeer.ai/practice/result.do?eventIdx=1&submissionSn=SW_PRBL_SBMS_116035&psProblemId=413 https://softeer.ai/practice/result.do?eventIdx=1&psProblemId=413&submissionSn=SW_PRBL_SBMS_116035 softeer.ai 1 2 3 4 5 6 7 8 9 10 11 import sys #sys.stdin = open("input2.txt",'r') #4,9,25,81 #2제곱, 3제곱 5제곱 9제곱 #2,3,5,9 #2^(n-1)+1 n = int(input()) answer = (2**n+1)**2 print(answer) cs 2023. 1. 1.
[python] Level2_8단 변속기 https://softeer.ai/practice/info.do?idx=1&eid=408 Softeer 연습문제를 담을 Set을 선택해주세요. 취소 확인 softeer.ai 1 2 3 4 5 6 7 8 9 10 11 import sys # 입력변수를 받기 array = list(map(int,sys.stdin.readline().split())) if array == [1,2,3,4,5,6,7,8]: print("ascending") elif array == [8,7,6,5,4,3,2,1]: print("descending") else: print("mixed") Colored by Color Scripter cs 2023. 1. 1.
[python] Level2_장애물 인식 프로그램 https://softeer.ai/practice/info.do?idx=1&eid=409 Softeer 연습문제를 담을 Set을 선택해주세요. 취소 확인 softeer.ai 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 import sys # 정사각형 n개 갯수받기 #sys.stdin = open("input1.txt","r") n = int(sys.stdin.readline()) # map 정보 저장 graph = [] for i in range(n): graph.append(list(map(int,input()))) # 모든 경로에 대해 탐색해야 하므.. 2023. 1. 1.
[python] Level1_A+B https://softeer.ai/practice/info.do?idx=1&eid=362 Softeer 연습문제를 담을 Set을 선택해주세요. 취소 확인 softeer.ai 1 2 3 4 cnt = int(input()) for i in range(1,cnt+1): a,b = map(int,input().split()) print(f"Case #{i}: {a+b}") cs 2023. 1. 1.
[python] Level1_최단거리 https://softeer.ai/practice/info.do?idx=1&eid=990 Softeer 연습문제를 담을 Set을 선택해주세요. 취소 확인 softeer.ai 1 2 3 4 5 6 7 count = 0 for i in range(5): n,m = map(str,input().split()) na, nb = map(int, n.split(":")) ma, mb = map(int, m.split(":")) count += (ma*60+mb)-(na*60+nb) print(count) cs 2022. 12. 31.
728x90