Pagini recente » Cod sursa (job #1500458) | Cod sursa (job #2123439) | Cod sursa (job #1591820) | Cod sursa (job #272701) | Cod sursa (job #2863505)
#include <fstream>
#include <math.h>
using namespace std;
ifstream fin("flip.in");
ofstream fout("flip.out");
int main()
{
int n,m,x,S,stemp, temp;
fin>>n>>m;
while(n<1 || n>=16 || m<1 || m>16){
fin>>n>>m;
}
int a[n][m];
int t[m];
for(int i = 0; i < m; i++){
t[i]=0;
}
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
fin>>x;
a[i][j]=x;
}
}
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
t[i]+=a[j][i];
stemp+=t[i];
}
}
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
a[j][i]*= -1;
temp+=a[j][i];
if(t[i]>a[j][i]){
stemp = temp;
}
stemp=S;
}
}
fout<<stemp;
return 0;
}