Cod sursa(job #1869722)

Utilizator petru.ciocirlanPetru Ciocirlan petru.ciocirlan Data 6 februarie 2017 09:22:13
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.41 kb
#include <bits/stdc++.h>
#define Mod 1999999973 /// const int Mod 1999999973
using namespace std;
long long LL = 1;

ifstream f("lgput.in");
ofstream g("lgput.out");

int power(int a, int b) {
    if(b == 0) return 1;
    if(b%2) return (LL*a*power(a, b-1))%Mod;
    int v = power(a, b/2);
    return (LL*v*v)%Mod;
}

int main()
{
    int x, y;
    f>>x>>y;
    g<<power(x, y);
    return 0;
}