Cod sursa(job #2898313)
Utilizator | Data | 6 mai 2022 16:25:30 | |
---|---|---|---|
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>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int n, p;
int lgput(int x, int y)
{
int nr = x;
while(y > 1)
{
x*= nr;
y--;
}
return x;
}
int main()
{
fin >> n >> p;
cout << lgput(n, p);
return 0;
}