SOLUZIONE:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <cstdlib> #include <iostream> using namespace std; int main() { int A [1001], N; cin >> N; int S [N] [N]; for (int i = 0; i <N; i++){ for (int j = 0;j <N; j++){ cin >> S[j][i]; } } if (N==2){ cout << S[0][1]/2<<" "<<S[0][1]/2; return 0;} A[2] = (S[1][0]-S[2][0]+S[2][1])/2; A[1] = S[1][0]-A[2]; int k =2; for (int i = 0; i <N; i++){ for (int j = 0;j <N; j++){ A[++k]= S[k-1] [0] -A[1]; } } for (int i = 1; i <= N ; i++) cout << A [i] << " "; return 0; } |
Nessun commento:
Posta un commento
Si prega di non commentare in modo volgare e/o offensivo.