Cod sursa(job #265939)
Utilizator | Data | 24 februarie 2009 19:15:36 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <fstream>
using namespace std;
int main()
{
unsigned long baza,putere,rez=1;
ifstream f("lgput.in");
f>>baza>>putere;
f.close();
unsigned long adun=baza;
while (putere>0)
{ if (putere%2!=0) rez=(rez*adun)%1999999973;
adun=(adun*adun)%;
putere=putere/2;
}
ofstream g("lgput.out");
g<<rez;
g.close();
return 0;
}