Jun's Development Journey

[SWEA] 1217. [S/W 문제해결 기본] Stack1 - 거듭 제곱 본문

SWEA/Intermediate

[SWEA] 1217. [S/W 문제해결 기본] Stack1 - 거듭 제곱

J_Jayce 2019. 8. 4. 12:30

문제

https://www.swexpertacademy.com/main/learn/course/lectureProblemViewer.do

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

www.swexpertacademy.com

 

 

풀이

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.*;
 
public class Solution {
    static Scanner scan = new Scanner(System.in);
    
    static int get_power(int N, int M) {
        if(M==1)
            return N;
        return N*get_power(N,M-1);
    }
    static void solution() {
        int N,M;
        for(int i=1;i<=10;i++) {
            scan.nextInt();
            N = scan.nextInt();
            M = scan.nextInt();
            System.out.println("#"+i+" "+get_power(N,M));
        }
    }
 
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        solution();
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter