Cod sursa(job #3030421)

Utilizator DomnulMilandruMilandru Nicon-David DomnulMilandru Data 17 martie 2023 17:43:03
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.76 kb
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <fstream>

using namespace std;
ifstream cin("lgput.in");
ofstream cout("lgput.out");
#define MOD 1999999973
long long putere(long long a,long long b)
{
    if(b==0)
      return 1;
    long long p=putere(a,b/2);
    p=(p*p)%MOD;
    if(b%2==1)
       return (p*a)%MOD;
    else
       return p;
}
long long a,b;
int main()
{
    cin>>a>>b;
    cout<<putere(a,b);
    return 0;
}