Browse Source

Attempt basic Square Pasture script

square-pasture
Abheek Dhawan 3 years ago
parent
commit
08258103a1
  1. 23
      usaco/Square Pasture/index.cpp

23
usaco/Square Pasture/index.cpp

@ -0,0 +1,23 @@
#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;
}
Loading…
Cancel
Save