T3000

Untitled

Oct 13th, 2021
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     double n,h,v;
  8.     cin>>n;
  9.     cin>>h;
  10.     cin>>v;
  11.  
  12.  
  13.     if( h>=n/2 && v>=n/2 )
  14.     {
  15.         cout<< v*h*4<<endl;
  16.  
  17.     }
  18.     else if(v>=n/2 && h<=n/2)
  19.     {
  20.         cout<<v*(n-h)*4<<endl;
  21.  
  22.  
  23.         }else if(v<=n/2 && h>=n/2) {
  24.  
  25.  
  26.             cout<<h*(n-v)*4<<endl;
  27.  
  28.  
  29.             }else if(v<=n/2 && h<=n/2){
  30.  
  31.                 cout<<(n-v)*(n-h)*4<<endl;
  32.  
  33.             }
  34.  
  35.                     return 0;
  36.             }
  37.  
  38.  
  39.  
Advertisement
Add Comment
Please, Sign In to add comment