Cod sursa(job #1480405)

Utilizator clipastefanClipa Stefan clipastefan Data 2 septembrie 2015 15:55:25
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.32 kb
#include <fstream>
#include <bitset>
#define M 1999999973LL
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long b,e,r=1LL;
int main()
{
    f>>b>>e;
    //b%=m;
    while(e)
    {
        if(e%2)r=(r*b)%M;
        b=(b*b)%M;
        e/=2;
    }
    g<<r<<"\n";
    return 0;
}