Created
December 26, 2021 10:58
-
-
Save key-del-jeeinho/3bac357781f3f9e5e5aca4ba6b0f3b65 to your computer and use it in GitHub Desktop.
[알고리즘 - 백준] 1009 분산처리 최적화 관련 질문
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//package baekjoon._1000_9999번대._1000번대._1009_분산처리.지인호; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int t = sc.nextInt(); | |
for (int caseCnt = 0; caseCnt < t; caseCnt++) { | |
int a = sc.nextInt(); | |
int b = sc.nextInt(); | |
int sum = 1; | |
for (int i = 0; i < b; i++) { | |
sum *= a; | |
if(sum > 1000000) { | |
sum %= 1000000; | |
} | |
} | |
System.out.println(sum % 10 == 0 ? 10 : sum % 10); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment