80分?????
查看原帖
80分?????
464732
luqyou楼主2022/10/29 20:44
#include<bits/stdc++.h>
using namespace std;
long long a,b;
long long quickpow(long long x,long long y){
	long long ans=1;
	while(y){
		if(y&1) ans*=x;
		x*=x;
		x%=1000000000;
		y>>=1;
		//printf("%d %d %d\n",x,y,ans);
		if(ans>1000000000) return -1;
	}
	return ans;
} 
int main(){
	scanf("%lld%lld",&a,&b);
	printf("%lld",quickpow(a,b));
	return 0;
}

2022/10/29 20:44
加载中...