5 条题解

  • -1
    @ 2023-5-29 19:23:56
    #include <iostream>
    #include <stack>
    #include <cmath>
    #include <vector>
    #include <string.h>
    #include <queue>
    #include <stdio.h>
    #include <iomanip>
    #include <cstdio>
    #include <algorithm>
    #define int long long
    #define double long double
    using namespace std;
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    int a, b;
    int power(int a, int b)
    {
    	int ans = 1; 
    	while(b)
    	{
    		if(b & 1)
    		{
    			ans = ans * a;
    		}
    		a = a * a;
    		b >>= 1;
    	}
    	return ans;
    }
    signed main()
    {
    	cin >> a >> b;
    	cout << power(a, b) << endl;
    	return 0;
    }
    

    当我写完题才发现要用递归...

信息

ID
1562
时间
1000ms
内存
256MiB
难度
6
标签
递交数
140
已通过
47
上传者