fork download
  1. /*
  2. * @Author: hungeazy
  3. * @Date: 2026-03-04 23:24:15
  4. * @Last Modified by: hungeazy
  5. * @Last Modified time: 2026-03-26 21:55:43
  6. */
  7. #include <bits/stdc++.h>
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. ios_base::sync_with_stdio(false);
  13. cin.tie(NULL); cout.tie(NULL);
  14. int n;
  15. cin >> n;
  16. for (int i = 1; i <= n; i++)
  17. {
  18. int x;
  19. cin >> x;
  20. int out = 1, in = 1;
  21. for (int j = 2; j <= sqrt(x); j++)
  22. if (x%j == 0)
  23. {
  24. int cnt = 0;
  25. while (x%j == 0)
  26. {
  27. x /= j;
  28. cnt++;
  29. if (cnt == 2)
  30. {
  31. out *= j;
  32. cnt = 0;
  33. }
  34. }
  35. if (cnt == 1) in *= j;
  36. }
  37. if (x > 1) in *= x;
  38. cout << out << " " << in << endl;
  39. }
  40. return 0;
  41. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty