Răspuns:
#include<iostream>
using namespace std;
int main()
{
float a1, a2, b1, b2;
cin>>a1>>a2; // produsul 1 in ambele variante
cin>>b1>>b2; //produsul 2 in ambele variante
int x;
if(a1>a2)
x=a1-a2;
else
x=a2-a1;
if(b1>b2)
x=x+b1-b2;
else
x=x+b2-b1;
cout<<"economiseste"<<x<<"lei";
return 0;
}