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