fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. const ll INF = 1e18;
  5.  
  6. //
  7. #define TIME (1.0* clock()/CLOCKS_PER_SEC)
  8. #define file(name) if(fopen(name".inp","r")){freopen(name".inp","r",stdin); freopen(name".out","w",stdout);}
  9. #define hackspeed ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
  10. //
  11.  
  12.  
  13. int main(){
  14. hackspeed;
  15. //file("");
  16. ll m,n,p,q; cin >> m >> n >> p >> q;
  17. ll s=-1;
  18. for(ll i=p-1 ; i<=p+1 ; i++){
  19. for(ll j=q-1 ; j<=q+1 ; j++){
  20. if(i>=1 && i<=m && j<=n&& j>=1){
  21. s++;
  22. }
  23. }
  24. }
  25. cout << s;
  26.  
  27.  
  28.  
  29.  
  30. //time
  31. cerr << "Time elapsed: " << TIME << "s.\n";
  32. return 0;
  33. }
Success #stdin #stdout #stderr 0.01s 5324KB
stdin
Standard input is empty
stdout
-1
stderr
Time elapsed: 0.005992s.