-
-
Save fredbr/55d967bb414af8c7a89258403be9b663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//solucao de Carolina Cmvc | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define MAXN 1005 | |
int main() | |
{ | |
ios_base::sync_with_stdio(false); | |
int n, m[MAXN][MAXN], l[MAXN], c[MAXN]; | |
cin>>n; | |
for (int i=0;i<n;i++) | |
{ | |
int sum=0; | |
for (int j=0;j<n;j++){ | |
cin>>m[i][j]; | |
sum+=m[i][j]; | |
} | |
l[i] = sum; | |
} | |
for (int j=0;j<n;j++) | |
{ | |
int sum = 0; | |
for (int i=0;i<n;i++) sum+=m[i][j]; | |
c[j] = sum; | |
} | |
int maior_peso=0; | |
for (int i=0;i<n;i++) | |
{ | |
for (int j=0;j<n;j++){ | |
m[i][j]=c[j]+l[i]-2*m[i][j]; | |
maior_peso = max(maior_peso, m[i][j]); | |
} | |
} | |
cout<<maior_peso<<endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment