Codeforces 1409B. Minimum Product Solution
///La ilaha illellahu muhammadur rasulullah
///******Bismillahir-Rahmanir-Rahim******///
///Abul Hasnat Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long t,a,b,x,y,n,m,d1,d2,z=0;
- cin>>t;
- while(t--)
- {
- cin>>a>>b>>x>>y>>n;
- d1=a-x;
- d2=b-y;
- m=(a-min(d1,n))*(b-min(d2,max(n-d1,z)));
- n=(a-min(d1,max(n-d2,z)))*(b-min(d2,n));
- cout<<min(m,n)<<endl;
- }
- }
No comments