Cod sursa(job #949513)

Utilizator alexflav23alfl23 alexflav23 Data 13 mai 2013 22:37:00
Problema Jocul Flip Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <fstream>
#include <limits>

using namespace std;

int main(int argc, const char * argv[]) {
    int n, m;
    long max = 0;
    
    ifstream input ("flip.in");
    ofstream output ("flip.out");
    
    input >> n >> m;
    
    for (int i = 0; i < n; i++) {
        long current_max = -std::numeric_limits<int>::max();
        long current;
        for (int j = 0; j < m; j++) {
            input >> current;
            current_max = current_max > current ? current_max : current;
        }
        max += current_max;
    }
    
    
    input.close();
    output.close();
    return 0;
}