Pagini recente » Cod sursa (job #2342969) | Cod sursa (job #1077055) | Cod sursa (job #1433490) | Istoria paginii template/implica-te/scrie-articole-2 | Cod sursa (job #894525)
Cod sursa(job #894525)
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#define mod 1999999973
using namespace std;
int n, p;
int pow(int exponent) {
int jumatate = exponent / 2;
if(exponent == 0) return 1;
if(exponent == 1) return (n % mod);
int sol;
sol = (pow(jumatate) * pow(jumatate)) % mod;
if(exponent % 2 == 1) sol = (sol * n) % mod;
return sol;
}
int main() {
ifstream f("lgput.in");
ofstream g("lgput.out");
f>>n>>p;
g<<pow(p)<<"\n";
return 0;
}