목록2023/10/17 (2)
Machineboy空
백준 12891번: DNA 비밀번호 - 슬라이딩 윈도우
#오답 whole, part = map(int, input().split()) DNA = str(input()) A,C,G,T = map(int, input().split()) Acount = 0 Ccount = 0 Gcount = 0 Tcount = 0 AvailableCount = 0 for i in range(whole-part): k = i + part for k in range(part+k): if DNA[i]=="A": Acount +=1 elif DNA[i]=="C": Ccount +=1 elif DNA[i]=="G": Gcount +=1 elif DNA[i]=="T": Tcount +=1 if Acount >= A and Ccount >=C and Gcount >=G and Tcount >..
Computer/Coding Test
2023. 10. 17. 21:10
백준 2018번: 수들의 합 (투 포인터)
n = int(input()) count = 1 start_index = 1 end_index = 1 sum = 1 while end_index !=n: if sum == n: count +=1 end_index +=1 sum += end_index elif sum >n: sum -= start_index start_index +=1 else: end_index +=1 sum += end_index print(count) 오답 이유) 이런 똑똑한 알고리즘이 있다니
Computer/Coding Test
2023. 10. 17. 12:58