Cod sursa(job #2941402)
Utilizator | Data | 17 noiembrie 2022 18:35:32 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.24 kb |
#include <fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
int main()
{
long long n,p,pr=1999999973,x;
f>>n>>p;x=n;
while(p>1)
{
x = n*x;
x = x%pr;
p--;
}
g<<x;
}