Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135052 徐英杰 x的n次方 C++ Accepted 1 MS 272 KB 582 2025-11-02 12:01:06

Tests(10/10):


Code:

#include <iostream> using namespace std; int jc(int n) { //递归出口 if (n == 0 || n == 1) { return 1; } //n的阶乘=n*(n-1的阶乘) return n * jc(n-1); } int gcd(int a,int b) { if (a%b == 0) { return b; } return gcd(b,a%b); } long long x_n(int x,int n) { if ( n == 0) { return 1; } if (x == 0) { return 0; } if (n == 1) { return x; } return x * x_n(x,n-1); } int main() { int a,b; cin>>a>>b; cout<<x_n(a,b); return 0; }