Cod sursa(job #2391223)
Utilizator | Data | 28 martie 2019 18:40:43 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.29 kb |
#include<fstream>
using namespace std;
ifstream in("modulo.in");
ofstream out("modulo.out");
int main ()
{
unsigned long long a,b,c,ct=1;
in>>a>>b>>c;
while(b)
{
if(b%2==1)
ct=ct*a%c;
a=a*a%c;
b/=2;
}
out<<ct;
return 0;
}