Cod sursa(job #1947552)
Utilizator | Data | 31 martie 2017 00:58:22 | |
---|---|---|---|
Problema | BFS - Parcurgere in latime | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <fstream>
#define PRIM 1999999973
#define modulo(x) x%=PRIM;
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long n,p,prod;
int main()
{
f>>n>>p;prod=1;
for(int i=1;i<=p;i<<=1)
{
if(i&p) {prod*=n;prod=modulo(prod);}
n*=n;n=modulo(n);
}
g<<prod<<'\n';
return 0;
}