Cod sursa(job #3284961)
Utilizator | Data | 12 martie 2025 13:22:51 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include<bits/stdc++.h>
using namespace std;
int n , a;
long long p;
const long long MOD=1999999973;
int main()
{
cin >> a >> n;
p=1;
while(n)
{
if(n % 2 == 1)
{
p = p * a;
}
a = a * a;
n /= 2;
}
cout<<p%MOD;
}