Advertisement
maridj

Untitled

Jan 22nd, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define int long long
  6.  
  7. const int MAXN = 1e3;
  8. void solve(int n) {
  9. if (n < 23 ) {
  10. cout << "NO\n";
  11. return;
  12. }
  13.  
  14. for (int a = 2 ; a < MAXN; a ++) {
  15. for (int b = a + 1; b < MAXN; b ++) {
  16. int c = n / (a * b);
  17. if (a * b * c != n) continue;
  18. if (a != b && a != c && b != c && c > 1) {
  19. cout << "YES\n" << a << ' ' << b << ' ' << c << '\n';
  20. return;
  21. }
  22. }
  23. }
  24. cout << "NO\n";
  25. }
  26.  
  27. signed main() {
  28. //freopen(".in", "r" , stdin);
  29. //freopen(".out", "w" , stdout);
  30. ios_base::sync_with_stdio(0);
  31. cin.tie(0);
  32. cout.tie(0);
  33. int t;
  34. cin >> t;
  35. for (int req = 0; req < t; ++req) {
  36. int n;
  37. cin >> n;
  38. solve(n);
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement