Cod sursa(job #2863505)

Utilizator alGabone88Toma Cristian alGabone88 Data 6 martie 2022 20:07:19
Problema Jocul Flip Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.88 kb
#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;
}