Cod sursa(job #73044)

Utilizator Data 16 iulie 2007 14:30:54
Problema Numere 2 Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.74 kb
#include <cstdio>

using namespace std;

#define FIN "numere2.in"
#define FOUT "numere2.out"
#define ll long long

ll P;
int A,B;
int i,j;

    int main()
    {
        freopen(FIN,"r",stdin);
        freopen(FOUT,"w",stdout);
        
        scanf("%lld", &P );
        
        for (i=2; i<=1000; i++)
         {
           A=i;
           if (A==P)
            {
              printf("%d\n%d\n",i,1);
              return 0;
            }
           for (j=2; j<=400; j++)
            {
             A*=i;
             if (A>=P) break;
            } 
           if (A==P)
            {
              printf("%d\n%d\n",i,j);
              return 0;
            }
         }
        return 0;
    }