Cod sursa(job #2898316)
Utilizator | Data | 6 mai 2022 16:27:50 | |
---|---|---|---|
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");
long long n, p;
long long lgput(long long x, long long y)
{
int nr = x;
while(y > 1)
{
x*= nr;
y--;
}
return x;
}
int main()
{
fin >> n >> p;
fout << lgput(n, p);
return 0;
}