Skip to content

Instantly share code, notes, and snippets.

@vdonchev
Created July 20, 2025 16:23
Show Gist options
  • Select an option

  • Save vdonchev/5e6da27b7e3656ed8ad2f6bdb3580d19 to your computer and use it in GitHub Desktop.

Select an option

Save vdonchev/5e6da27b7e3656ed8ad2f6bdb3580d19 to your computer and use it in GitHub Desktop.
#include<iostream>
using namespace std;
int main ()
{
int w1, h1, w2, h2;
cin >> w1 >> h1 >> w2 >> h2;
if (w2 < w1) {
cout << ((h1 + h2) * 2) + (w2 + (w1 - w2) + w1) + 4;
} else {
cout << ((h1 + h2) * 2) + (w2 + (w2 - w1) + w1) + 4;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment