fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int root = sqrt(2017.0);
  5. for (int a=2; a<=root; a++) {
  6. for (int b=2; b<=root; b++) {
  7. for (int c=2; c<=root; c++) {
  8. for (int d=2; d<=root; d++) {
  9. if (pow(a, b) + pow(c, d) == 2017) {
  10. printf("%d^%d+%d^%d\n", a, b, c, d);
  11. }
  12. }
  13. }
  14. }
  15. }
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.17s 2168KB
stdin
Standard input is empty
stdout
3^4+44^2
9^2+44^2
12^3+17^2
17^2+12^3
44^2+3^4
44^2+9^2