Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. if(i<K && leftyes==false && (mas[i][0]==1 || mas[i][1]==1))
  2. {
  3. left=i;
  4. leftyes=true;
  5. ls=mas[i][0]+mas[i][1];
  6. }
  7. if(i>=K && (mas[i][0]==1 || mas[i][1]==1))
  8. {
  9. right=i;
  10. rightyes=true;
  11. rs=mas[i][0]+mas[i][1];
  12. }
  13. i++;
  14. }
  15. boolean leftfirst=false,rightfirst=false,justleft=false,justright=false;
  16. if(leftyes && rightyes)
  17. {
  18. if(K-left==right-K)
  19. {
  20. if(ls>=rs)
  21. {
  22. leftfirst=true;
  23. }
  24. else
  25. {
  26. rightfirst=true;
  27. }
  28. }
  29. else
  30. if(K-left<right-K)
  31. {
  32. leftfirst=true;
  33. }
  34. else
  35. {
  36. rightfirst=true;
  37. }
  38. }
  39. else
  40. if(leftyes)
  41. {
  42. justleft=true;
  43. }
  44. else
  45. if(rightyes)
  46. {
  47. justright=true;
  48. }
  49. else
  50. {
  51. t=0;
  52. }
  53.  
  54. if(leftfirst)
  55. {
  56. for(i=K;i>=left;i--)
  57. {
  58. if(mas[i][0]==1)
  59. {
  60. s--;
  61. }
  62. if(mas[i][1]==1)
  63. {
  64. s--;
  65. }
  66. }
  67. t=(K-left)*2;
  68. }
  69. else
  70. if(rightfirst)
  71. {
  72. for(i=K;i<=right;i++)
  73. {
  74. if(mas[i][0]==1)
  75. {
  76. s--;
  77. }
  78. if(mas[i][1]==1)
  79. {
  80. s--;
  81. }
  82. }
  83. t=(right-K)*2;
  84. }
  85. else
  86. if(justleft || rightfirst)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement