sfsdfsdf
an anonymous user
·
C++
#include <iostream>
using namespace std;
long long s_pot(long long b,long long n){
long long a=b%1000;
if(n==0)return 1;
if(n%2!=0) return (s_pot(a*a,(n-1)/2)*a)%1000;
else return s_pot(a*a,n/2)%1000;
}
int main() {
long long a,n;
while(cin>>a>>n){
cout<<s_pot(a,n)%1000<<endl;
}
return 0;
}
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.