20251116 baekjoon
This commit is contained in:
parent
bc2418389d
commit
26d486d52b
11
code_study/Baekjoon/python/1009.py
Normal file
11
code_study/Baekjoon/python/1009.py
Normal file
@ -0,0 +1,11 @@
|
||||
result = []
|
||||
for _ in range(int(input())) :
|
||||
a, b = map(int, input().split())
|
||||
a %= 10
|
||||
|
||||
if a==0 : result.append("10")
|
||||
elif a in [1, 5, 6] : result.append(str(a))
|
||||
elif a in [4, 9] : result.append(str(a) if b%2 else str(a*a%10))
|
||||
else : result.append(str(a**(b%4)%10) if b%4 else str(a**4%10))
|
||||
|
||||
print('\n'.join(result))
|
||||
Loading…
x
Reference in New Issue
Block a user