2 solutions

  • 2
    @ 2025-5-18 16:05:01
    #include<bits/stdc++.h> 
    using namespace std; 
    int main() 
    { 
      int h,w;
      cin>>h>>w;
      int r,c;
      cin>>r>>c;
      int res=0;
      if(r-1>=1) res++;
      if(r+1<=h) res++;
      if(c-1>=1) res++; 
      if(c+1<=w) res++;
      cout<<res; 
      return 0;
    }
    

    Information

    ID
    2319
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    46
    Accepted
    19
    Uploaded By