Advertisement
dllbridge

Untitled

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