Code for USACO practice problems
cpp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
517 B

#include <iostream>
using namespace std;
int main() {
freopen("square.in", "r", stdin);
freopen("square.in", "w", stdout);
int x1, y1, x2, y2;
cin >> x1, y1, x2, y2;
int a1, b1, a2, b2;
cin >> a1, b1, a2, b2;
int min_x, min_y, max_x, max_y;
min_x = min(min(x1, x2), min(a1, a2));
min_y = min(min(y1, y2), min(b1, b2));
max_x = max(min(x1, x2), min(a1, a2));
max_y = max(min(y1, y2), min(b1, b2));
int x_len = max_x - min_x;
int y_len = max_y - min_y;
cout << x_len * y_len << endl;
}