Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define int int64_t
  3.  
  4. using namespace std;
  5.  
  6. int32_t main()
  7. {
  8. ios::sync_with_stdio(false);
  9. cin.tie(0); cout.tie(0);
  10. int t;
  11. cin >> t;
  12. while (t--)
  13. {
  14. int n;
  15. cin >> n;
  16. int a = -1, b = -1;
  17. for (int i = 2; i * i <= n; i++)
  18. {
  19. if (n % i == 0)
  20. {
  21. n /= i;
  22. a = i;
  23. break;
  24. }
  25. }
  26. for (int i = 2; i * i <= n; i++)
  27. {
  28. if (n % i == 0 && a != i)
  29. {
  30. n /= i;
  31. b = i;
  32. break;
  33. }
  34. }
  35. if (a != -1 && b != -1 && a != n && b != n)
  36. {
  37. cout << "YES\n";
  38. cout << a << " " << b << " " << n << " ";
  39. cout << "\n";
  40. }
  41. else
  42. cout << "NO\n";
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement