Cod sursa(job #1883835)
| Utilizator | Data | 18 februarie 2017 11:30:38 | |
|---|---|---|---|
| Problema | GFact | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.58 kb |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
long long find(long long A){
long long fact = 1;
long long tempB = 1;
for(long long i = 1; i <= A; i++ )
{
if(A % i == 0)
tempB = tempB*i;
if(tempB == A)
return i;
// fact = fact * i;
// if( fact % A == 0 )
// return i;
}
return -1;
}
int main() {
long long P,Q;
long long A;
ifstream in("gfact.in");
ofstream out("gfact.out");
in >> P >> Q;
A = pow(P,Q);
out << find(A);
return 0;
}