Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CzterechHetmanow1
- {
- static int a,b,c,d; // rozkład hetmanów na szachownicy
- public static void main(String[] args)
- {
- ustaw();
- int i;
- for (i = 0; i < 4; i++)
- System.out.print(i == a ? "X" : "O");
- System.out.println();
- for (i = 0; i < 4; i++)
- System.out.print(i == b ? "X" : "O");
- System.out.println();
- for (i = 0; i < 4; i++)
- System.out.print(i == c ? "X" : "O");
- System.out.println();
- for (i = 0; i < 4; i++)
- System.out.print(i == d ? "X" : "O");
- System.out.println();
- }
- static void ustaw()
- {
- for (a = 0; a < 4; a++)
- for (b = 0; b < 4; b++)
- {
- if (a == b || a == b-1 || a == b+1) continue;
- for (c = 0; c < 4; c++)
- {
- if (b == c || b == c-1 || b == c+1 ||
- a == c || a == c-2 || a == c+2) continue;
- for (d = 0; d < 4; d++)
- {
- if (c == d || c == d-1 || c == d+1 ||
- b == d || b == d-2 || b == d+2 ||
- a == d || a == d-3 || a == d+3) continue;
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement