Cod sursa(job #3210391)

Utilizator mihaigeorgescuGeorgescu Mihai mihaigeorgescu Data 6 martie 2024 10:01:06
Problema Ridicare la putere in timp logaritmic Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.35 kb
#include <fstream>

using namespace std;
ifstream fcin("lgput.in");
ofstream fout("lgput.out");
long long x,y,p,c,n;
int main()
{
    fcin>>x>>y;
    p=1;
    while(y!=0)
    {
        c=y%2;
        if(c==1)
        {
            p=(p*x)%1999999973;
        }
      y=y/2;
      x=x*x;
    }
    fout<<p%1999999973;
    return 0;
}