[SWEA] #1217 거듭 제곱

KwonSC·2021년 11월 8일
0

SWEA - Java

목록 보기
10/26
post-thumbnail

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14dUIaAAUCFAYD&categoryId=AV14dUIaAAUCFAYD&categoryType=CODE


Code

import java.util.Scanner;

class Solution {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        for (int testCase = 1; testCase <= 10; testCase++) {
            int n = sc.nextInt();
            int x = sc.nextInt();
            int y = sc.nextInt();
            System.out.printf("#%d %d\n", n, (int)Math.pow(x, y));
        }
    }
}

Solution

재귀로 풀어야하는 문제지만 빠르게 해결하기위해 Math.pow()를 사용하였다.

0개의 댓글

관련 채용 정보