Cod sursa(job #3284965)
Utilizator | Data | 12 martie 2025 13:24:53 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int n , a;
long long p;
const long long MOD=1999999973;
int main()
{
fin >> a >> n;
p=1;
while(n)
{
if(n % 2 == 1)
{
p = p * a;
}
a = a * a;
n /= 2;
}
fout<<p%MOD;
}