fork download
  1. /* Author : Nguyen Thanh Tung - Tran Hung Dao High School for Gifted Student */
  2.  
  3. #include <bits/stdc++.h>
  4.  
  5. using namespace std;
  6.  
  7. #define endl '\n'
  8. #define ft first
  9. #define sc second
  10. #define ll long long
  11. #define vll vector<ll>
  12. #define vp vector<pll>
  13. #define pll pair<ll, ll>
  14. #define ull unsigned long long
  15. #define FOR(i, l, r) for (ll i = (l); i <= (r); ++i)
  16. #define FORD(i, r, l) for (ll i = (r); i >= (l); --i)
  17.  
  18. const long long maxn = 1e6 + 9;
  19. const long long N = 3e4 + 9;
  20. const long long oo = 1e18 + 9;
  21. const long long INF = 0x3f;
  22. const long long MOD = 1e9 + 7;
  23.  
  24. #define TASK "code"
  25.  
  26. void solve()
  27. {
  28. ll n;
  29. cin >> n;
  30. while (n--)
  31. {
  32. ll x;
  33. cin >> x;
  34. bool check = true;
  35. FOR(i, 1, x - 3)
  36. {
  37. FOR(j, i + 1, x - 2)
  38. {
  39. FOR(k, j + 1, x - 1)
  40. {
  41. if (i * i * i + j * j * j + k * k * k == x * x * x)
  42. {
  43. cout << i << " " << j << " " << k << endl;
  44. check = false;
  45. break;
  46. }
  47. }
  48. if (check == false)
  49. {
  50. break;
  51. }
  52. }
  53. if (check == false)
  54. {
  55. break;
  56. }
  57. }
  58. if (check)
  59. {
  60. cout << 0 << endl;
  61. }
  62. }
  63. }
  64.  
  65. int main()
  66. {
  67. ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  68. //freopen(TASK ".inp", "r", stdin);
  69. //freopen(TASK ".out", "w", stdout);
  70. solve();
  71. return 0;
  72. }
  73. /// Stay calm, read the question slowly and understand the question, it is often simpler than you imagine
Success #stdin #stdout 0s 5288KB
stdin
4
4
6
9
19
stdout
0
3 4 5
1 6 8
3 10 18