Cod sursa(job #348424)

Utilizator TFifesPorcescu Alexandru TFifes Data 15 septembrie 2009 19:30:01
Problema Numere 2 Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include<iostream>
#include<fstream>
#include<math.h>
using namespace std;
int main ()
{
    ifstream x("numere2.in");
    ofstream y("numere2.out");
    if(!x)
    {
        cout<<"Unable to open this file";
        return -1;
    }
    unsigned long p,a;
    unsigned short b;
    x>>p;
    for(a=1;a<=p;a++)
    {
        if(p%a==0)
        break;
    }
    b=1;
    while(1)
    {
        if(pow(a,b)==p)
        {
            y<<a<<'/n'<<b;
            break;
        }
        b++;
    }
    x.close();
    y.close();
    return 0;
}