단기 피지컬 상승용,, 빨리 풀기가 생각보다 까다롭다!
https://www.acmicpc.net/problem/11866
n, k = map(int,input().split())
arr = []
for i in range(n):
arr.append(i+1)
now = 0
print("<", end="")
while arr:
now += k - 1
now %= len(arr)
temp = arr.pop(now)
if not arr:
print(str(temp) + ">")
else:
print(str(temp) + ", ", end="")
https://www.acmicpc.net/problem/1009
t = int(input())
for _ in range(t):
a, b = map(int,input().split())
arr = []
temp = a % 10
arr.append(temp)
while True:
temp *= a
if temp % 10 in arr:
break
else:
temp = temp % 10
arr.append(temp)
ans = arr[(b-1) % len(arr)]
if ans == 0:
print(10)
else:
print(ans)