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