백준 알고리즘/시뮬레이션43 백준 1057 파이썬 num, kim, im = map(int, input().split())count=0flag =1while num!=1: count=count+1 num = num/2 kim = (kim +1)//2 im = (im +1) //2 if kim == im: print(count) flag=0 breakif flag == 1: print(-1) 2018. 11. 6. 백준 1094 파이썬 length = int(input())n = 64while n > length: n = n/2lists = [n]sum=0count=0while n != 1: n = n/2 lists.append(n)for i in lists: if sum+i 2018. 11. 6. 백준 2455 파이썬 a_1, b_1 = map(int, input().split())a_2, b_2 =map(int, input().split())a_3,b_3 = map(int, input().split())a_4,b_4 =map(int, input().split()) num = []num.append(b_1)num.append(num[0]- a_2 + b_2)num.append(num[1] - a_3 + b_3)num.append(num[2] - a_4 + b_4)print(max(num)) 2018. 11. 6. 백준 1021번 파이썬 N,M = map( int, input().split())a=[j for j in range(1,N+1)]location = list(map(int, input().split()))count=0for i in range(len(location)): r=[0]*len(a) left=0 right=0 if a[0] == location[i]: del a[0] else: for k in range(len(a)): r[k]=a[k] while r[0] !=location[i]: r.insert(0,r[-1]) del r[-1] right+=1 l=a while a[0] != location[i]: a.append(a[0]) del a[0] left += 1 if right>=left: count=count+le.. 2018. 9. 18. 이전 1 ··· 6 7 8 9 10 11 다음