Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int a[10][10];
- bool check(int x1, int x2, int x3, int x4, int x5){
- for(int i = 0; i < 4; i++){
- int s = x1*a[i][0] + x2*a[i][1] + x3*a[i][2] + x4*a[i][3] + x5*a[i][4];
- if (s != a[i][5])
- return 0;
- }
- return 1;
- }
- int main() {
- ifstream cin ("in.txt");
- ofstream cout ("out.txt");
- for(int i = 0; i < 4; i++){
- for(int j = 0; j < 6; j++)
- cin >> a[i][j];
- }
- for(int x1 = -15; x1 < 15; x1++){
- for(int x2 = -15; x2 < 15; x2++){
- for(int x3 = -15; x3 < 15; x3++){
- for(int x4 = -15; x4 < 15; x4++){
- for(int x5 = -15; x5 < 15; x5++){
- if (check(x1, x2, x3, x4, x5) == 1){
- cout << x1 << ' ' << x2 << ' ' << x3 << ' ' << x4 << ' ' << x5;
- if (x1*x1 + x2*x2 + x3*x3 + x4*x4 + x5*x5 == 75)
- cout << " +";
- cout << endl;
- }
- }
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement