0009.c 514 B

1234567891011121314151617181920212223242526272829303132
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. int
  4. main(int argc, const char **argv)
  5. {
  6. uint64_t res = 0;
  7. uint64_t a = 1, b = 1, c = 1;
  8. uint64_t upper_limit = 1000;
  9. for ( a = 1; a < upper_limit; ++a ) {
  10. for ( b = 1; b < upper_limit; ++b ) {
  11. for ( c = 1; c < upper_limit; ++c ) {
  12. if ( ((a*a) + (b*b)) != (c*c) ) {
  13. continue;
  14. }
  15. if ( (a+b+c) != 1000 ) {
  16. continue;
  17. }
  18. res = a*b*c;
  19. goto end;
  20. }
  21. }
  22. }
  23. end:
  24. printf("Result = %ld!\n", res);
  25. (void) argc; (void) argv;
  26. return 0;
  27. }