Cod sursa(job #1710565)

Utilizator circeanubogdanCirceanu Bogdan circeanubogdan Data 29 mai 2016 12:04:13
Problema Orase Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <fstream>
#include <cmath>
using namespace std;
ifstream f("orase.in");
ofstream g("orase.out");
int x,y,difmax,summax,c1,n,m,c2,c3,c4;
int main()
{
    f>>n>>m;
    while(f>>x>>y)
    {
        if(x+y>summax) {summax=x+y;c1=x;c2=y;}
        else
        if(abs(x-y)>difmax) {difmax=abs(x-y);c3=x;c4=y;}
    }
    g<<c2+c4+abs(c3-c1);
    return 0;
}