Varianta 90 / Subiectul 3 / Problema 4 |
#include<fstream.h> #include<math.h> ifstream f("n.in"); void main() { long x,y,mx=0,my=0; f>>x; while(f>>y) { if(x>0 && y>0 && x+y>mx+my) { mx=x; my=y; } else if(x>0 && y>0 && x+y==mx+my && labs(x-y)>labs(mx-my)) { mx=x; my=y; } x=y; } cout<<mx<<" "<<my; } |