Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- int m[51][51], somaL[51], somaC[51];
- int main(){
- int n; scanf("%d", &n);
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- scanf("%d", &m[i][j]);
- somaL[i] += m[i][j];
- somaC[j] += m[i][j];
- }
- }
- int certa;
- if(somaL[0] == somaL[1]){
- certa = somaL[0];
- }
- else{
- certa = somaL[2];
- }
- int linha_errado, coluna_errado;
- for(int i = 0; i < n; i++){
- if(somaL[i] != certa){
- linha_errado = i;
- break;
- }
- }
- for(int j = 0; j < n; j++){
- if(somaC[j] != certa){
- coluna_errado = j;
- break;
- }
- }
- printf("%d %d", certa - (somaL[linha_errado]-m[linha_errado][coluna_errado]), m[linha_errado][coluna_errado]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement