Advertisement
ibragimova_mariam

Codeforces №2 Пять в ряд (Educational Codeforces Round 25)

Jul 19th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package copp_111;
  7.  
  8. /**
  9. * @param args the command line arguments
  10. */
  11. import java.util.Scanner;
  12.  
  13. public class Copp_111 {
  14.  
  15. public static void main(String[] args) {
  16. Scanner sc = new Scanner(System.in);
  17.  
  18. String [][]mass = new String[10][];
  19. for(int i = 0; i < 10; i ++){
  20. mass[i] = sc.nextLine().split(" ");
  21. }
  22.  
  23. StringBuilder [][]massBuilder = new StringBuilder[10][10];
  24. for(int i = 0; i < 10; i ++){
  25. for(int j = 0; j < 10; j ++){
  26. massBuilder[i][j].replace(0, 1, mass[i][j]);
  27. }
  28. }
  29.  
  30. StringBuilder temp = new StringBuilder();
  31.  
  32. int st_i, st_j;
  33. int count;
  34. for(int q = 0; q < 2; q ++){
  35. if(q == 1){ // reverse
  36. for(int i = 0; i < 10; i ++){
  37. for(int j = 0; j < 10; j ++){
  38. temp.replace(0, 1, massBuilder[i][j].toString());
  39. massBuilder[i][j] = massBuilder[j][i];
  40. massBuilder[j][i].replace(0, 1, temp.toString());
  41. }
  42. }
  43. for(int i = 0; i < 10; i ++){
  44. for(int j = 0; j < 10; j ++){
  45. System.out.print(massBuilder[i][j] + " ");
  46. }
  47. System.out.println();
  48. }
  49. }
  50. for(int i = 0; i < 10; i ++){
  51. st_i = i;
  52. for(int j = 0; j < 6; j ++){
  53. st_j = j;
  54. count = 0;
  55. for(int k = 0; k < 5; k ++){
  56. if(massBuilder[st_i][st_j].toString().equals("X")){
  57. count++;
  58. }
  59. st_j++;
  60. }
  61. if(count == 4){
  62. System.out.println("YES");
  63. }
  64. }
  65. }
  66. }
  67.  
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement