fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. long long gcd(long long a, long long b) {
  5. return b ? gcd(b, a % b) : a;
  6. }
  7.  
  8. int main() {
  9. long long mx = 1000, cnt = 0;
  10. for (long long i = 1; i <= mx; i++) {
  11. for (long long j = i + 1; j <= mx; j++) {
  12. if (gcd(i * i + j * j, j - i) != gcd(i * i * i + j * j * j, j - i)) {
  13. if (cnt < 5)
  14. cout << i << " " << j << endl;
  15. cnt++;
  16. }
  17. }
  18. }
  19. cout << cnt << endl;
  20. return 0;
  21. }
Success #stdin #stdout 0.11s 4460KB
stdin
Standard input is empty
stdout
2 18
2 34
2 50
2 66
2 82
13448