fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios::sync_with_stdio(0);
  6. cin.tie(0);
  7. cout.tie(0);
  8. int t;
  9. cin >> t;
  10. while(t--!=0)
  11. {
  12. int x, temp1 = 0, temp2 = 0, flag = 0;
  13. cin >> x;
  14. vector<int> v;
  15. temp1 = x/3;
  16. for(int i=1; i<=temp1; i++)
  17. {
  18. if(temp1%i == 0)
  19. {
  20. temp2 = i;
  21. v.push_back(temp2);
  22. }
  23. }
  24. for(int i=0; i<v.size(); i++)
  25. {
  26. for(int j=i+1; j<v.size(); j++)
  27. {
  28. cout << v[i];
  29. if(((2*v[i]) + (2*v[i]) + (v[i]*v[i])) == x)
  30. {
  31. flag = 1;
  32. break;
  33. }
  34. else if(((2*v[i]) + (2*v[j]) + (v[i]*v[j])) == x)
  35. {
  36. flag = 1;
  37. break;
  38. }
  39. }
  40. }
  41. if(flag == 1)
  42. {
  43. cout << "YES";
  44. }
  45. else
  46. {
  47. cout << "NO";
  48. }
  49. cout << "\n";
  50. }
  51. return 0;
  52. }
Success #stdin #stdout 0.01s 5432KB
stdin
1
5
stdout
NO