Advertisement
rotti321

DifiMin

Oct 18th, 2017
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.  
  6. int n,d,x,y;
  7.  
  8. cin >> n;
  9.  
  10. x=1; y=n;
  11.  
  12. for(d=2;d*d<n;d++) /// [ 2, sqrt(n) )
  13. {
  14. if(n%d==0){
  15. x=d; y=n/d;
  16. /// cout<<d<<" "<<n/d<<endl;
  17. }
  18. }
  19. if(d*d==n){
  20. x=d; y=d;
  21. /// cout<<d<<" "<<d<<endl;
  22. }
  23.  
  24. cout<<x<<" "<<y;
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement