fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int a[3][3] = { {3, 4, 5}, {6, 7, 8}, {9, 10, 11} };
  9.  
  10. do {
  11. for (unsigned q=0; q<3; ++q)
  12. if (a[q][0] * a[q][1] * a[q][2] != a[0][q] * a[1][q] * a[2][q])
  13. goto NO;
  14.  
  15. for (unsigned q=0; q<9; ++q)
  16. cout << a[0][q] << (q%3 && q ? ' ' : '\n');
  17.  
  18. cout << endl;
  19. return 0;
  20.  
  21. NO: ;
  22. } while (next_permutation(begin(a), end(a)));
  23.  
  24. return 0;
  25. }
Time limit exceeded #stdin #stdout 5s 5660KB
stdin
Standard input is empty
stdout
Standard output is empty