이미지를 클릭하시면 문제 링크로 연결됩니다.


import java.util.Scanner;
// 4일차 (해시맵) - 백준 해시 해킹
public class day04Baek26008 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long answer = 1L;
int n = sc.nextInt();
int m = sc.nextInt();
int a = sc.nextInt();
int h = sc.nextInt();
for(int i = 0; i < n-1; i ++){
answer = (answer * m)%1000000007;
}
System.out.println(answer);
}
}