1. Problem
2. My Solution
import sys
kg = int(sys.stdin.readline().strip())
count = 0
while(True):
if kg == 0:
break
elif kg % 5 == 0:
count += (kg//5)
break
else:
if kg < 0:
count = -1
break
kg -= 3
count += 1
print(count)
3. Learned
1. Problem
2. My Solution
import sys
a,b = map(int,sys.stdin.readline().strip().split())
print(a+b)
3. Others' Solutions
4. Learned
1. Problem
2. Others' Solutions
import sys
import math
test_n = int(sys.stdin.readline().strip())
for i in range(test_n):
x,y = map(int,sys.stdin.readline().strip().split())
distance = y - x
sqrt = int(math.sqrt(distance))
if distance < 4: # 1,2,3인 경우 해당 거리를 출력
print(distance)
elif distance == sqrt * sqrt: # 거리가 제곱수와 같은 경우
print((sqrt * 2)-1)
elif distance <= sqrt + (sqrt * sqrt): # 거리가 제곱수 + 제곱근 보다 작거나 같은 경우
print(sqrt * 2)
else: # 거리가 제곱수 + 제곱근 보다 큰 경우
print((sqrt * 2) +1)
3. Learned
1. Problem
2. My Solution
import sys
n = int(sys.stdin.readline().strip())
num = 2
result = []
while(n != 1):
if n % num == 0:
n = n // num
result.append(num)
else:
num += 1
for i in range(len(result)):
print(result[i])
3. Others' Solutions
import sys
n = int(sys.stdin.readline().strip())
num = 2
while(num**2 <= n and n > 1):
if n % num == 0:
n = n // num
print(num)
else:
num += 1
if n!=1:
print(n)
4. Learned