fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6.  
  7.  
  8. int main() {
  9.  
  10.  
  11. int ro, co;
  12. int x;
  13. for (int i = 1; i <= 5; i++)
  14. {
  15.  
  16. for (int j = 1; j <= 5; j++)
  17. {
  18. cin >> x;
  19. if (x == 1) {
  20. ro = i;
  21. co = j;
  22.  
  23. }
  24.  
  25. }
  26. }
  27.  
  28.  
  29.  
  30.  
  31.  
  32. int mov=abs(3-co) + abs(3-ro);
  33. cout << mov;
  34.  
  35.  
  36. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
1303774154