Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n,m,r,c; ///n linii, m coloane
- /*
- 11 12 ... 1m
- 21 22 ....2m
- ............
- n1 n2 ... nm
- */
- cin>>n>>m>>r>>c;
- if((r==1 &&c==1)||(r==1 && c==m )||(r==n && c==m)||(r==n && c==1)) ///colturile
- cout<<2;
- else if(r==1|| r==n || c==1 || c==m) ///marginea
- cout<<3;
- else
- cout<<4;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement