Cod sursa(job #349448)

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


            }