diff --git a/code_study/Baekjoon/python/1009.py b/code_study/Baekjoon/python/1009.py new file mode 100644 index 0000000..919ae68 --- /dev/null +++ b/code_study/Baekjoon/python/1009.py @@ -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)) \ No newline at end of file