Advertisement
Guest User

sim bac 2018 s3 ex 3

a guest
Mar 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void radical(int n,int &x,int &y)
  5. {
  6.  int e,d=2;
  7.    y=n;
  8.    x=1;
  9.     while(n>1)
  10.     {
  11.         e=0;
  12.         while(n%d==0)
  13.         {
  14.             n=n/d;
  15.             e++;
  16.  
  17.         }
  18.            for(int i=1;i<=e/2;i++)
  19.                 x=x*d;
  20.                 d++;
  21.     }
  22.  
  23.     y=y/(x*x);
  24. }
  25.  
  26. int main()
  27. {
  28.   int n,x,y;
  29.   cin>>n;
  30.   radical(n,x,y);
  31.   cout<<x<<" "<<y;
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement