Deep_Dev

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14dUIaAAUCFAYD 

 

SW Expert Academy

SW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!

swexpertacademy.com

 


 

 

๋‹จ์ˆœํžˆ ๋ฐ˜๋ณต๋ฌธ์œผ๋กœ ์ ‘๊ทผํ•˜๋ฉด D1 ๊ธ‰๋ฌธ์ œ์ด์ง€๋งŒ 

์ถœ์ œ์˜๋„๋Š” ์žฌ๊ท€ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜๋Š”๊ฒƒ์ด๊ธฐ๋•Œ๋ฌธ์— D3์ธ๊ฒƒ๊ฐ™๋‹ค.

 

 

import java.util.Scanner;
class Solution
{
    public static int rec(int x, int y){
        if(y==0)
            return 1;
        return x*rec(x,y-1);
    }
    public static void main(String args[]) throws Exception
    {
    Scanner kb = new Scanner(System.in);
        for(int t=1; t<=10; t++){
            int test=kb.nextInt();
            int x=kb.nextInt();
            int y=kb.nextInt();
            System.out.println("#"+t+" "+rec(x,y));
        }
    }
}