Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- #define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- #define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
- #define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
- int main() {
- optimize();
- ll x1, x2, x3, x4, h;
- cin >> x1 >> x2 >> x3 >> x4 >> h;
- if (x1 > x3 && x2 > x4) swap(x1, x3), swap(x2, x4);
- if (x2 <= x3) cout << "0" << endl;
- else if (x1 <= x3 && x4 <= x2) cout << (x4 - x3) * h << endl;
- else if (x3 <= x1 && x2 <= x4) cout << (x2 - x1) * h << endl;
- else if (x3 < x2) cout << (x2 - x3) * h << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement