jakaria_hossain

codeforce - Beautiful Matrix

Mar 12th, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include<bits/stdC++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int a,c=0,x,y,z,sum=0;
  6. for(int i=0;i<25;i++)
  7. {
  8. c++;
  9. scanf("%d",&a);
  10. if(a==1)z=c;
  11. }
  12. //cout<<z<<endl;
  13. x= z%5;
  14. y=z/5;
  15.  
  16. if(x>0)y+=1;
  17. if(x==0)x+=1;
  18. x=abs(3-x);
  19. y=abs(3-y);
  20. printf("%d\n",x+y);
  21. return 0;
  22. }
Add Comment
Please, Sign In to add comment