Cod sursa(job #3347459)
| Utilizator | Data | 16 martie 2026 19:22:26 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.32 kb |
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long a,b,x;
int main()
{
fin>>a>>b;
x = 1;
while(b){
if(b & 1 == 1){
x = (1LL * x * a)%1999999973;
}
b >>= 1LL;
a = (1LL * a * a) % 1999999973;
}
fout << x << endl;
return 0;
}
