Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int n,x,y,c;
- cin >>n>>x>>y>>c;
- int a,b;
- int s=0;
- int k=0;
- for(int i=0;i<n;i++){
- for(int j=0;j<n;j++){
- if((i+j)%2==0){
- a=0;
- }
- else{
- a=1;
- }
- ;
- if(x==j and y==i){
- if(c==a){
- s=1;
- }
- }
- }
- }
- for(int i=0;i<n;i++){
- for(int j=0;j<n;j++){
- if(j<=n-1-i){
- b=1;
- }
- else{
- b=0;
- }
- if(x==j and y==i){
- if(c==b){
- k=1;
- }
- }
- }
- }
- if(k==1 and s==1){
- cout<<"3";
- }
- else if(k==1){
- cout<<"2";
- }
- else if(s==1){
- cout<<"1";
- }
- else cout<<4;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment