1. Problem
2. My Solution
import sys
n = int(sys.stdin.readline().strip())
count = 1
top = 1
bottom = 1
level = 2
flag = True
loopflag = True
while(True):
if loopflag == True and n == count:
print(f"{top}/{bottom}")
break
for i in range(1,level+1):
if count == n:
loopflag = True
break
elif flag == True and i == 1:
bottom += 1
count += 1
elif flag == True:
bottom -= 1
top += 1
count += 1
elif flag == False and i == 1:
top += 1
count += 1
elif flag == False:
top -= 1
bottom += 1
count += 1
level += 1
flag = not flag
3. Others' Solutions
import sys
n = int(sys.stdin.readline().strip())
level = 1
level_max = 1
while(n > level_max):
level += 1
level_max += level
pos = level_max - n
if level % 2 == 0:
top = level - pos
bottom = pos + 1
else:
top = pos + 1
bottom = level - pos
print(f"{top}/{bottom}")
4. Learned
1. Problem
2. Others' Solutions
import sys
a,b,v = map(int,sys.stdin.readline().strip().split())
if (v-b)%(a-b) == 0:
print((v-b)//(a-b))
else:
print((v-b)//(a-b)+1)
3. Learned