Cod sursă (job #131354)

Utilizator avatar projectAndu Stanescu Andu projectAndu IP ascuns
Problemă 2sah (clasele 11-12) Compilator cpp | 0,40 kb
Rundă Arhiva de probleme Status evaluat
Dată 9 mar. 2015 21:47:27 Scor 6
#include <iostream>
#include <fstream>
#define M 100003
using namespace std;

ifstream d("2sah.in");
ofstream o("2sah.out");
int x,y;

int putere(int b,int p)
{
    if(p==1)
        return b;
    if(p%2==1)
        return b*putere(b*b%M,p/2)%M;
    if(p%2==0)
        return putere(b*b%M,p/2)%M;
}

int main()
{
    int t;
    d>>t;
    d>>x>>y;
    o<<putere(3,y-1);

    return 0;
}