SWEA 1217 (S/W 문제해결 기본) 4일차 - 거듭 제곱

1 개요[ | ]

SWEA 1217 (S/W 문제해결 기본) 4일차 - 거듭 제곱
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 3-7

2 C++[ | ]

3 Java[ | ]

import java.util.*;
public class Solution {
	static Scanner sc  = new Scanner(System.in);
	static int multi(int n, int m) {
		if( m<2 ) return n;
		return n * multi(n, m-1);
	}
	public static void main(String[] args) {
		for(int i=1; i<=10; i++) {
			int tc = sc.nextInt();
			int N = sc.nextInt();
			int M = sc.nextInt();
			System.out.format("#%d %d\n", tc, multi(N, M));
		}
		sc.close();
	}
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}