Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int a[10][10];
  4.  
  5. bool check(int x1, int x2, int x3, int x4, int x5){
  6. for(int i = 0; i < 4; i++){
  7. int s = x1*a[i][0] + x2*a[i][1] + x3*a[i][2] + x4*a[i][3] + x5*a[i][4];
  8. if (s != a[i][5])
  9. return 0;
  10. }
  11. return 1;
  12. }
  13. int main() {
  14. ifstream cin ("in.txt");
  15. ofstream cout ("out.txt");
  16. for(int i = 0; i < 4; i++){
  17. for(int j = 0; j < 6; j++)
  18. cin >> a[i][j];
  19. }
  20. for(int x1 = -15; x1 < 15; x1++){
  21. for(int x2 = -15; x2 < 15; x2++){
  22. for(int x3 = -15; x3 < 15; x3++){
  23. for(int x4 = -15; x4 < 15; x4++){
  24. for(int x5 = -15; x5 < 15; x5++){
  25. if (check(x1, x2, x3, x4, x5) == 1){
  26. cout << x1 << ' ' << x2 << ' ' << x3 << ' ' << x4 << ' ' << x5;
  27. if (x1*x1 + x2*x2 + x3*x3 + x4*x4 + x5*x5 == 75)
  28. cout << " +";
  29. cout << endl;
  30. }
  31. }
  32. }
  33. }
  34. }
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement