Advertisement
rotti321

AtCoder 250 A

May 19th, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <bits/stdc++.h>
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. int n,m,r,c; ///n linii, m coloane
  9. /*
  10. 11 12 ... 1m
  11. 21 22 ....2m
  12. ............
  13. n1 n2 ... nm
  14. */
  15.  
  16. cin>>n>>m>>r>>c;
  17. if((r==1 &&c==1)||(r==1 && c==m )||(r==n && c==m)||(r==n && c==1)) ///colturile
  18. cout<<2;
  19. else if(r==1|| r==n || c==1 || c==m) ///marginea
  20. cout<<3;
  21. else
  22. cout<<4;
  23.  
  24.  
  25. return 0;
  26. }
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement