fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int n[5] = {0};
  8. const int N = 150;
  9.  
  10. void Pow(long long int *P){
  11. for(int i = 1; i <= N; i++){
  12. P[i-1] = pow(i,5);
  13. }
  14. }
  15.  
  16. int * Eu(int be, int en, long long int *P, int *n, int j){
  17. for (int i = be; i < en; ++i){
  18. if (n[4] == 0) return n;
  19. P[N] += P[i]; n[j] = i;
  20. if (i < 3)
  21. n = Eu(i, en, P, n, j + 1);
  22. else {
  23. size_t k = lround(pow(P[i], 0.2));
  24. if (P[k] == P[N]) n[4] = k;
  25. }
  26. P[N] -= P[i];
  27. }
  28. return n;
  29. }
  30.  
  31. int * Eu(long long int *P, int en){
  32. n[4] = 0;
  33. return Eu(1, en, P, n, 0);
  34. }
  35.  
  36. int main(){
  37. long long int P[N+1];
  38. Pow(P);
  39. int en;
  40. cin >> en;
  41.  
  42. Eu(P, en);
  43.  
  44. for (int i =0; i < 5; i++)
  45. cout << n[i] << " ";
  46. return 0;
  47. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
0 0 0 0 0