Josif_tepe

Untitled

Mar 14th, 2026
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4.     int n,x,y,c;
  5.     cin >>n>>x>>y>>c;
  6.     int a,b;
  7.     int s=0;
  8.     int k=0;
  9.     for(int i=0;i<n;i++){
  10.         for(int j=0;j<n;j++){
  11.             if((i+j)%2==0){
  12.                 a=0;
  13.             }
  14.            
  15.             else{
  16.               a=1;
  17.             }
  18.            ;
  19.                
  20.                
  21.            
  22.                    if(x==j and y==i){
  23.                      if(c==a){
  24.                          s=1;
  25.                      }  
  26.                    }
  27.             }
  28.            
  29.        
  30.      
  31.     }
  32.      
  33.    
  34.    
  35.     for(int i=0;i<n;i++){
  36.         for(int j=0;j<n;j++){
  37.             if(j<=n-1-i){
  38.                 b=1;
  39.             }
  40.             else{
  41.                 b=0;
  42.             }
  43.             if(x==j and y==i){
  44.                 if(c==b){
  45.                   k=1;  
  46.                 }
  47.             }
  48.         }
  49.        
  50.     }
  51.     if(k==1 and s==1){
  52.         cout<<"3";
  53.    
  54.     }
  55.     else if(k==1){
  56.         cout<<"2";
  57.     }
  58.     else if(s==1){
  59.         cout<<"1";
  60.     }
  61.     else cout<<4;
  62.  
  63.    
  64.    
  65.     return 0;
  66. }
  67.  
  68.  
  69.  
  70.  
Advertisement
Add Comment
Please, Sign In to add comment