Advertisement
Guest User

Problem C [F2]

a guest
Apr 9th, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     ios_base::sync_with_stdio(false);
  9.     cin.tie(NULL);
  10.  
  11.     int n;
  12.     cin >> n;
  13.  
  14.     for (int i = 2; i * 1ll * i <= n; i++)
  15.     {
  16.         while (n % i == 0)
  17.         {
  18.             cout << i << " ";
  19.             n /= i;
  20.         }
  21.     }
  22.  
  23.     if (n > 1)
  24.         cout << n << " ";
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement