import math
def solution(n):
return math.ceil(n / 7)
def solution(n):
return (n - 1) // 7 + 1
def solution(num_list):
even = 0
odd = 0
for num in num_list:
if num % 2 == 0:
even += 1
else:
odd += 1
return [even, odd]
def solution(num_list):
answer = [0,0]
for n in num_list:
answer[n%2]+=1
return answer
def solution(my_string, n):
return "".join([a*n for a in my_string])
def solution(numbers):
return sorted(numbers, reverse=True)[0] * sorted(numbers, reverse=True)[1]
def solution(sides):
sides = sorted(sides)
return 1 if sides[0] + sides[1] > sides[2] else 2
def solution(numbers, num1, num2):
return numbers[num1:num2+1]
def solution(n):
return [i for i in range(1, n+1, 2)]
def solution(numbers):
return [n * 2 for n in numbers]
def solution(message):
return len(message) * 2
def solution(keyinput, board):
answer = [0,0]
for k in keyinput:
if k == "up":
if answer[1] < (board[1]-1)/2:
answer[1] += 1
else:
continue
elif k == "down":
if answer[1] > -(board[1]-1)/2:
answer[1] -= 1
else:
continue
elif k == "right":
if answer[0] < (board[0]-1)/2:
answer[0] += 1
else:
continue
elif k == "left":
if answer[0] > -(board[0]-1)/2:
answer[0] -= 1
else:
continue
return answer
def solution(id_pw, db):
idx = [0,0,0]
for info in db:
if id_pw == info:
idx[0] += 1
elif (id_pw[0] == info[0]) & (id_pw[1] != info[1]):
idx[1] += 1
elif id_pw[0] != info[0]:
idx[2] += 1
if idx[0] >= 1:
return "login"
elif idx[1] >= 1:
return "wrong pw"
else:
return "fail"
def solution(dots):
dots = sorted(dots)[1:3]
width = abs(dots[1][0] - dots[0][0])
height = abs(dots[1][1] - dots[0][1])
return width * height
def solution(chicken):
service_chicken = chicken // 10
coupon_left = service_chicken + chicken % 10
while coupon_left > 9:
coupon_left -= 10
service_chicken += 1
coupon_left += 1
return service_chicken
def solution(chicken):
return int(chicken*0.11111111111)
사실 아직 이 로직이 이해가 잘 되지는 않는다...! 조금 더 봐야할듯 싶다.