From 26d486d52b7cb162efebea8f53c9335ff3a30738 Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Sun, 16 Nov 2025 22:52:25 +0900 Subject: [PATCH] 20251116 baekjoon --- code_study/Baekjoon/python/1009.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 code_study/Baekjoon/python/1009.py 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