Cod sursa(job #2979149)

Utilizator bogdan_raul55Bogdan Raul bogdan_raul55 Data 14 februarie 2023 19:53:29
Problema Ridicare la putere in timp logaritmic Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.42 kb
#include <fstream>
using namespace std;

ifstream fin("lgput.in");
ofstream fout("lgput.out");

int main()
{
    int n, p;
    fin >> n >> p;
    int np = 1;
    if(p == 1){
        np = p;
    }
    else{
        if(p == 0){
            np = 1;
        }
        else{
            for(int i = 1; i <= p; i++){
                np = np*n;
            }
        }
    }
    int x = np % 1999999973;
    fout << x;
    return 0;
}