Cod sursa(job #2901840)
| Utilizator | Data | 14 mai 2022 16:18:58 | |
|---|---|---|---|
| Problema | Jocul Flip | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std ;
ifstream in("flip.in");
ofstream out("flip.out");
int n , m , x , ma1 = 0 , ma2 = 0 ;
int main(){
in >> n >> m ;
for ( int i = 1 ; i <= n ; i ++ )
{
for ( int j = 1 ; j <= m ; j ++ )
{
in >> x;
if ( x < 0 )
{
ma1 += x ;
}
else
{
ma2 += x ;
}
}
}
ma1 = abs(ma1);
out << max( ma1 , ma2 );
}