#include<iostream>
using namespace std;
int poww(int a, int b) {
int ans = 1, base = a;
while (b != 0) {
if (b & 1 != 0)
ans *= base;
base *= base;
b >>= 1;
}
return ans;
}
int main()
{
int a = pow(2, 3);
cout << a;
}
快速幂
#include<bits/stdc++.h>
using namespace std;
string a,b;
int k;
int c[1000001];
int main()
{
cin>>a>>b;
reverse(a.begin(),a.end());
reverse(b.begin(),b.end());
for(int i=0;i<a.size();i++)
{
for(int j=0;j<b.size();j++)
{
c[i+j]+=(a[i]-48)*(b[j]-48);
}
}
for(k=0;k<=a.size()+b.size();k++)
c[k]+=c[k-1]/10,c[k-1]%=10;
while(!c[k]&&k>=1)k--;
for(;k>=0;k--)
cout<<c[k];
return 0;
}
高精度的理解
learn to say no and not be a yes man