Cod sursa(job #1357942)

Utilizator andreiventuVentuneac Andrei andreiventu Data 24 februarie 2015 11:17:13
Problema Jocul Flip Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("flip.in");
ofstream g("flip.out");
int main()
{
   int i,j,s=0,a,b,S=0;
   f>>a>>b;
   int v[a][b];
   for(i=1;i<=a;i++)
   {
       for(j=1;j<=b;j++)
       {
           f>>v[i][j];
           if(v[i][j]<0)
           {
               s=s+v[i][j];
           }
           else{
            S=S+v[i][j];

           }
       }
   }
   if(S>s*(-1))
   {
       g<<S;
   }
   else{g<<s;}
    return 0;
}