Cod sursa(job #1169715)
| Utilizator | Data | 11 aprilie 2014 21:59:05 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.52 kb |
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
//ofstream fdeb("console.out");
int a, b;
int mod = 1999999973;
void solve(int a, int b)
{
//fdeb << "a: " << a << " b: " << b << "\n";
long long x, y = 1;
x = a;
for(int i = 0; (1 << i) <= b; i++)
{
if(((1 << i) && b) > 0)
y *= x % mod;
x *= x % mod;
}
//fdeb << y;
fout << y;
}
void read()
{
fin >> a >> b;
solve(a, b);
}
int main()
{
read();
return 0;
}
