fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. void f9052(long long n) {
  4. long long a, b, c, d, beg = 2, ab, cd;
  5. for (a = beg; a * a < n; a++)
  6. for (b = beg, ab = pow(a, beg); ab < n; b++, ab *= a)
  7. for (c = beg; ab + c * c <= n; c++)
  8. for (d = beg, cd = pow(c, beg); ab + cd <= n; d++, cd *= c)
  9. if (ab + cd == n)
  10. printf("%lld\t%lld\t%lld\t%lld\t%lld\n", a, b, c, d, ab + cd);
  11. }
  12. int main() {
  13. f9052(2017);
  14. f9052(23456789);
  15. return 0;
  16. }
Success #stdin #stdout 0.35s 2168KB
stdin
Standard input is empty
stdout
3	4	44	2	2017
9	2	44	2	2017
12	3	17	2	2017
17	2	12	3	2017
44	2	3	4	2017
44	2	9	2	2017
985	2	4742	2	23456789
4742	2	985	2	23456789