fork(2) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. unsigned long long n;
  8. cin>>n;
  9.  
  10. for (int i = 2; i < sqrt(n)+0.00001; ) {
  11. if ( n % i == 0 ){
  12. std::cout << i << ' ';
  13. n /= i;
  14. }
  15. else{
  16. ++i;
  17. }
  18. }
  19. if ( n > 1 )
  20. std::cout << n;
  21. return 0;
  22. }
Success #stdin #stdout 0s 15240KB
stdin
6943960340 
stdout
2 2 5 97 1787