Mai intai trebuie sa te autentifici.
Cod sursa(job #3132456)
Utilizator | Data | 22 mai 2023 20:16:04 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | c-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.59 kb |
#include <stdio.h>
const int n_max = 10001;
const int m = 1999999973;
long long exp_log(float x, int n)
{
if (n < 0)
{
x = 1.0 / x;
n = (-1) * n;
}
if (n == 0)
{
return 1;
}
float p = 1;
while (n > 0)
{
if (n % 2)
{
p = p * x;
}
x = x * x;
n = n / 2;
}
return p;
}
int main(void)
{
unsigned int n, p;
long long sol;
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%d %d", &n, &p);
printf("%lld\n", sol); // Afisam solutia
return 0;
}