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