알고리즘/SWEA

[SWEA 1217] 거듭 제곱

히더 2018. 8. 10. 15:12

출처 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14dUIaAAUCFAYD&


#include <iostream>

#include <algorithm>

#include <memory.h>

using namespace std;


int a, b;


int cal(int now)

{

if (now == 1)return a;

return (a * cal(now - 1));

}


int main()

{

int T; int t;

T = 10;

while (T--)

{

cin >> t;

cin >> a >> b;


cout << "#" << t << " " << cal(b) << endl;

}


return 0;

}