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