Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
रियल-टाइम एडिटर
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
लेआउट
विभाजित
संयुक्त
परिवर्तन हाइलाइट करें
स्मार्ट
शब्द
अक्षर
सिंटैक्स हाइलाइटिंग
सिंटैक्स चुनें
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
Untitled diff
बनाया गया
11 वर्ष पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
8 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
215 लाइनें
सभी को कॉपी करें
0 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
210 लाइनें
सभी को कॉपी करें
import java.io.*;
import java.io.*;
import java.util.*;
import java.util.*;
import java.math.*;
import java.math.*;
public class TicTac implements Runnable {
public class TicTac implements Runnable {
private static BufferedReader in;
private static BufferedReader in;
private static PrintWriter out;
private static PrintWriter out;
private static StringTokenizer st;
private static StringTokenizer st;
private static Random rnd;
private static Random rnd;
static class Pair {
static class Pair {
final int x, y;
final int x, y;
public Pair(int x, int y) {
public Pair(int x, int y) {
this.x = x;
this.x = x;
this.y = y;
this.y = y;
}
}
}
}
private void solve() throws IOException {
private void solve() throws IOException {
while (true) {
while (true) {
char[][] field = readField();
char[][] field = readField();
if (isOver(field))
if (isOver(field))
break;
break;
if (!isEmpty(field))
if (!isEmpty(field))
throw new AssertionError();
throw new AssertionError();
field[1][1] = 'x';
field[1][1] = 'x';
printField(field);
printField(field);
field = readField();
field = readField();
Pair corner = selectCorner(field);
Pair corner = selectCorner(field);
field[corner.x][corner.y] = 'x';
field[corner.x][corner.y] = 'x';
printField(field);
printField(field);
field = readField();
field = readField();
Pair opposite = new Pair(2 - corner.x, 2 - corner.y);
Pair opposite = new Pair(2 - corner.x, 2 - corner.y);
if (field[opposite.x][opposite.y] == '.') {
if (field[opposite.x][opposite.y] == '.') {
field[opposite.x][opposite.y] = 'x';
field[opposite.x][opposite.y] = 'x';
printField(field);
printField(field);
continue;
continue;
}
}
Pair support = selectSupport(field);
Pair support = selectSupport(field);
field[support.x][support.y] = 'x';
field[support.x][support.y] = 'x';
printField(field);
printField(field);
field = readField();
field = readField();
Pair last = selectLast(field);
Pair last = selectLast(field);
field[last.x][last.y] = 'x';
field[last.x][last.y] = 'x';
printField(field);
printField(field);
}
}
}
}
private boolean isEmpty(char[][] field) {
private boolean isEmpty(char[][] field) {
for (int i = 0; i <= 2; i++)
for (int i = 0; i <= 2; i++)
for (int j = 0; j <= 2; j++)
for (int j = 0; j <= 2; j++)
if (field[i][j] != '.')
if (field[i][j] != '.')
return false;
return false;
return true;
return true;
}
}
private Pair selectLast(char[][] field) {
private Pair selectLast(char[][] field) {
for (int x0 = 0; x0 <= 2; x0++) {
for (int x0 = 0; x0 <= 2; x0++) {
for (int y0 = 0; y0 <= 2; y0++) {
for (int y0 = 0; y0 <= 2; y0++) {
for (int x1 = 0; x1 <= 2; x1++) {
for (int x1 = 0; x1 <= 2; x1++) {
for (int y1 = 0; y1 <= 2; y1++) {
for (int y1 = 0; y1 <= 2; y1++) {
int dx = x1 - x0;
int dx = x1 - x0;
int dy = y1 - y0;
int dy = y1 - y0;
if (Math.abs(dx) + Math.abs(dy) == 0)
if (Math.abs(dx) + Math.abs(dy) == 0)
continue;
continue;
if (Math.abs(dx) > 1 || Math.abs(dy) > 1)
if (Math.abs(dx) > 1 || Math.abs(dy) > 1)
continue;
continue;
if (field[x0][y0] != 'x')
if (field[x0][y0] != 'x')
continue;
continue;
if (field[x1][y1] != 'x')
if (field[x1][y1] != 'x')
continue;
continue;
int x2 = x1 + dx, y2 = y1 + dy;
int x2 = x1 + dx, y2 = y1 + dy;
if (x2 >= 0 && x2 <= 2 && y2 >= 0 && y2 <= 2 && field[x2][y2] == '.') {
if (x2 >= 0 && x2 <= 2 && y2 >= 0 && y2 <= 2 && field[x2][y2] == '.') {
return new Pair(x2, y2);
return new Pair(x2, y2);
}
}
}
}
}
}
}
}
}
}
throw new AssertionError();
throw new AssertionError();
}
}
private Pair selectSupport(char[][] field) {
private Pair selectSupport(char[][] field) {
for (int x = 0; x <= 2; x++) {
for (int x = 0; x <= 2; x++) {
for (int y = 0; y <= 2; y++) {
for (int y = 0; y <= 2; y++) {
if ((x + y) % 2 == 1 && field[x][y] == '.') {
if ((x + y) % 2 == 1 && field[x][y] == '.') {
field[x][y] = 'x';
field[x][y] = 'x';
int ways = calcWays(field);
int ways = calcWays(field);
if (ways >= 2) {
if (ways >= 2) {
return new Pair(x, y);
return new Pair(x, y);
}
}
field[x][y] = '.';
field[x][y] = '.';
}
}
}
}
}
}
throw new AssertionError();
throw new AssertionError();
}
}
private int calcWays(char[][] field) {
private int calcWays(char[][] field) {
boolean[][] used = new boolean[3][3];
boolean[][] used = new boolean[3][3];
for (int x0 = 0; x0 <= 2; x0++) {
for (int x0 = 0; x0 <= 2; x0++) {
for (int y0 = 0; y0 <= 2; y0++) {
for (int y0 = 0; y0 <= 2; y0++) {
for (int x1 = 0; x1 <= 2; x1++) {
for (int x1 = 0; x1 <= 2; x1++) {
for (int y1 = 0; y1 <= 2; y1++) {
for (int y1 = 0; y1 <= 2; y1++) {
int dx = x1 - x0;
int dx = x1 - x0;
int dy = y1 - y0;
int dy = y1 - y0;
if (Math.abs(dx) + Math.abs(dy) == 0)
if (Math.abs(dx) + Math.abs(dy) == 0)
continue;
continue;
if (Math.abs(dx) > 1 || Math.abs(dy) > 1)
if (Math.abs(dx) > 1 || Math.abs(dy) > 1)
continue;
continue;
if (field[x0][y0] != 'x')
if (field[x0][y0] != 'x')
continue;
continue;
if (field[x1][y1] != 'x')
if (field[x1][y1] != 'x')
continue;
continue;
int x2 = x1 + dx, y2 = y1 + dy;
int x2 = x1 + dx, y2 = y1 + dy;
if (x2 >= 0 && x2 <= 2 && y2 >= 0 && y2 <= 2 && field[x2][y2] == '.') {
if (x2 >= 0 && x2 <= 2 && y2 >= 0 && y2 <= 2 && field[x2][y2] == '.') {
used[x2][y2] = true;
used[x2][y2] = true;
}
}
}
}
}
}
}
}
}
}
int res = 0;
int res = 0;
for (int i = 0; i <= 2; i++)
for (int i = 0; i <= 2; i++)
for (int j = 0; j <= 2; j++)
for (int j = 0; j <= 2; j++)
if (used[i][j])
if (used[i][j])
++res;
++res;
return res;
return res;
}
}
private Pair selectCorner(char[][] field) {
private Pair selectCorner(char[][] field) {
int[] xs = { 0, 2 }, ys = { 0, 2 };
int[] xs = { 0, 2 }, ys = { 0, 2 };
for (int x : xs)
for (int x : xs)
for (int y : ys) {
for (int y : ys) {
if (field[x][y] == '.')
if (field[x][y] == '.')
return new Pair(x, y);
return new Pair(x, y);
}
}
throw new AssertionError();
throw new AssertionError();
}
}
private void printField(char[][] field) {
private void printField(char[][] field) {
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++)
out.println(new String(field[i]));
out.println(new String(field[i]));
out.flush();
out.flush();
}
}
private char[][] readField() throws IOException {
private char[][] readField() throws IOException {
char[][] result = new char[3][];
char[][] result = new char[3][];
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++)
result[i] = nextToken().toCharArray();
result[i] = nextToken().toCharArray();
return result;
return result;
}
}
private boolean isOver(char[][] field) {
private boolean isOver(char[][] field) {
for (int i = 0; i <= 2; i++)
for (int i = 0; i <= 2; i++)
for (int j = 0; j <= 2; j++)
for (int j = 0; j <= 2; j++)
if (field[i][j] != 'x')
if (field[i][j] != 'x')
return false;
return false;
return true;
return true;
}
}
public static void main(String[] args) {
public static void main(String[] args) {
new TicTac().run();
new TicTac().run();
}
}
public void run() {
public void run() {
final String className = this.getClass().getName().toLowerCase();
final String className = this.getClass().getName().toLowerCase();
try {
try {
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
try {
in = new BufferedReader(new InputStreamReader(System.in));
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter(System.out);
out = new PrintWriter(new FileWriter("output.txt"));
} catch (FileNotFoundException e) {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
}
rnd = new Random();
rnd = new Random();
solve();
solve();
out.close();
out.close();
} catch (IOException e) {
} catch (IOException e) {
e.printStackTrace();
e.printStackTrace();
System.exit(1);
System.exit(1);
}
}
}
}
private String nextToken() throws IOException {
private String nextToken() throws IOException {
while (st == null || !st.hasMoreTokens()) {
while (st == null || !st.hasMoreTokens()) {
String line = in.readLine();
String line = in.readLine();
if (line == null)
if (line == null)
return null;
return null;
st = new StringTokenizer(line);
st = new StringTokenizer(line);
}
}
return st.nextToken();
return st.nextToken();
}
}
private int nextInt() throws IOException {
private int nextInt() throws IOException {
return Integer.parseInt(nextToken());
return Integer.parseInt(nextToken());
}
}
private long nextLong() throws IOException {
private long nextLong() throws IOException {
return Long.parseLong(nextToken());
return Long.parseLong(nextToken());
}
}
private double nextDouble() throws IOException {
private double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
return Double.parseDouble(nextToken());
}
}
}
}
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
import java.io.*; import java.util.*; import java.math.*; public class TicTac implements Runnable { private static BufferedReader in; private static PrintWriter out; private static StringTokenizer st; private static Random rnd; static class Pair { final int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } } private void solve() throws IOException { while (true) { char[][] field = readField(); if (isOver(field)) break; if (!isEmpty(field)) throw new AssertionError(); field[1][1] = 'x'; printField(field); field = readField(); Pair corner = selectCorner(field); field[corner.x][corner.y] = 'x'; printField(field); field = readField(); Pair opposite = new Pair(2 - corner.x, 2 - corner.y); if (field[opposite.x][opposite.y] == '.') { field[opposite.x][opposite.y] = 'x'; printField(field); continue; } Pair support = selectSupport(field); field[support.x][support.y] = 'x'; printField(field); field = readField(); Pair last = selectLast(field); field[last.x][last.y] = 'x'; printField(field); } } private boolean isEmpty(char[][] field) { for (int i = 0; i <= 2; i++) for (int j = 0; j <= 2; j++) if (field[i][j] != '.') return false; return true; } private Pair selectLast(char[][] field) { for (int x0 = 0; x0 <= 2; x0++) { for (int y0 = 0; y0 <= 2; y0++) { for (int x1 = 0; x1 <= 2; x1++) { for (int y1 = 0; y1 <= 2; y1++) { int dx = x1 - x0; int dy = y1 - y0; if (Math.abs(dx) + Math.abs(dy) == 0) continue; if (Math.abs(dx) > 1 || Math.abs(dy) > 1) continue; if (field[x0][y0] != 'x') continue; if (field[x1][y1] != 'x') continue; int x2 = x1 + dx, y2 = y1 + dy; if (x2 >= 0 && x2 <= 2 && y2 >= 0 && y2 <= 2 && field[x2][y2] == '.') { return new Pair(x2, y2); } } } } } throw new AssertionError(); } private Pair selectSupport(char[][] field) { for (int x = 0; x <= 2; x++) { for (int y = 0; y <= 2; y++) { if ((x + y) % 2 == 1 && field[x][y] == '.') { field[x][y] = 'x'; int ways = calcWays(field); if (ways >= 2) { return new Pair(x, y); } field[x][y] = '.'; } } } throw new AssertionError(); } private int calcWays(char[][] field) { boolean[][] used = new boolean[3][3]; for (int x0 = 0; x0 <= 2; x0++) { for (int y0 = 0; y0 <= 2; y0++) { for (int x1 = 0; x1 <= 2; x1++) { for (int y1 = 0; y1 <= 2; y1++) { int dx = x1 - x0; int dy = y1 - y0; if (Math.abs(dx) + Math.abs(dy) == 0) continue; if (Math.abs(dx) > 1 || Math.abs(dy) > 1) continue; if (field[x0][y0] != 'x') continue; if (field[x1][y1] != 'x') continue; int x2 = x1 + dx, y2 = y1 + dy; if (x2 >= 0 && x2 <= 2 && y2 >= 0 && y2 <= 2 && field[x2][y2] == '.') { used[x2][y2] = true; } } } } } int res = 0; for (int i = 0; i <= 2; i++) for (int j = 0; j <= 2; j++) if (used[i][j]) ++res; return res; } private Pair selectCorner(char[][] field) { int[] xs = { 0, 2 }, ys = { 0, 2 }; for (int x : xs) for (int y : ys) { if (field[x][y] == '.') return new Pair(x, y); } throw new AssertionError(); } private void printField(char[][] field) { for (int i = 0; i < 3; i++) out.println(new String(field[i])); out.flush(); } private char[][] readField() throws IOException { char[][] result = new char[3][]; for (int i = 0; i < 3; i++) result[i] = nextToken().toCharArray(); return result; } private boolean isOver(char[][] field) { for (int i = 0; i <= 2; i++) for (int j = 0; j <= 2; j++) if (field[i][j] != 'x') return false; return true; } public static void main(String[] args) { new TicTac().run(); } public void run() { final String className = this.getClass().getName().toLowerCase(); try { try { in = new BufferedReader(new FileReader("input.txt")); out = new PrintWriter(new FileWriter("output.txt")); } catch (FileNotFoundException e) { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); } rnd = new Random(); solve(); out.close(); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } private String nextToken() throws IOException { while (st == null || !st.hasMoreTokens()) { String line = in.readLine(); if (line == null) return null; st = new StringTokenizer(line); } return st.nextToken(); } private int nextInt() throws IOException { return Integer.parseInt(nextToken()); } private long nextLong() throws IOException { return Long.parseLong(nextToken()); } private double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } }
परिवर्तित टेक्स्ट
फ़ाइल खोलें
import java.io.*; import java.util.*; import java.math.*; public class TicTac implements Runnable { private static BufferedReader in; private static PrintWriter out; private static StringTokenizer st; private static Random rnd; static class Pair { final int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } } private void solve() throws IOException { while (true) { char[][] field = readField(); if (isOver(field)) break; if (!isEmpty(field)) throw new AssertionError(); field[1][1] = 'x'; printField(field); field = readField(); Pair corner = selectCorner(field); field[corner.x][corner.y] = 'x'; printField(field); field = readField(); Pair opposite = new Pair(2 - corner.x, 2 - corner.y); if (field[opposite.x][opposite.y] == '.') { field[opposite.x][opposite.y] = 'x'; printField(field); continue; } Pair support = selectSupport(field); field[support.x][support.y] = 'x'; printField(field); field = readField(); Pair last = selectLast(field); field[last.x][last.y] = 'x'; printField(field); } } private boolean isEmpty(char[][] field) { for (int i = 0; i <= 2; i++) for (int j = 0; j <= 2; j++) if (field[i][j] != '.') return false; return true; } private Pair selectLast(char[][] field) { for (int x0 = 0; x0 <= 2; x0++) { for (int y0 = 0; y0 <= 2; y0++) { for (int x1 = 0; x1 <= 2; x1++) { for (int y1 = 0; y1 <= 2; y1++) { int dx = x1 - x0; int dy = y1 - y0; if (Math.abs(dx) + Math.abs(dy) == 0) continue; if (Math.abs(dx) > 1 || Math.abs(dy) > 1) continue; if (field[x0][y0] != 'x') continue; if (field[x1][y1] != 'x') continue; int x2 = x1 + dx, y2 = y1 + dy; if (x2 >= 0 && x2 <= 2 && y2 >= 0 && y2 <= 2 && field[x2][y2] == '.') { return new Pair(x2, y2); } } } } } throw new AssertionError(); } private Pair selectSupport(char[][] field) { for (int x = 0; x <= 2; x++) { for (int y = 0; y <= 2; y++) { if ((x + y) % 2 == 1 && field[x][y] == '.') { field[x][y] = 'x'; int ways = calcWays(field); if (ways >= 2) { return new Pair(x, y); } field[x][y] = '.'; } } } throw new AssertionError(); } private int calcWays(char[][] field) { boolean[][] used = new boolean[3][3]; for (int x0 = 0; x0 <= 2; x0++) { for (int y0 = 0; y0 <= 2; y0++) { for (int x1 = 0; x1 <= 2; x1++) { for (int y1 = 0; y1 <= 2; y1++) { int dx = x1 - x0; int dy = y1 - y0; if (Math.abs(dx) + Math.abs(dy) == 0) continue; if (Math.abs(dx) > 1 || Math.abs(dy) > 1) continue; if (field[x0][y0] != 'x') continue; if (field[x1][y1] != 'x') continue; int x2 = x1 + dx, y2 = y1 + dy; if (x2 >= 0 && x2 <= 2 && y2 >= 0 && y2 <= 2 && field[x2][y2] == '.') { used[x2][y2] = true; } } } } } int res = 0; for (int i = 0; i <= 2; i++) for (int j = 0; j <= 2; j++) if (used[i][j]) ++res; return res; } private Pair selectCorner(char[][] field) { int[] xs = { 0, 2 }, ys = { 0, 2 }; for (int x : xs) for (int y : ys) { if (field[x][y] == '.') return new Pair(x, y); } throw new AssertionError(); } private void printField(char[][] field) { for (int i = 0; i < 3; i++) out.println(new String(field[i])); out.flush(); } private char[][] readField() throws IOException { char[][] result = new char[3][]; for (int i = 0; i < 3; i++) result[i] = nextToken().toCharArray(); return result; } private boolean isOver(char[][] field) { for (int i = 0; i <= 2; i++) for (int j = 0; j <= 2; j++) if (field[i][j] != 'x') return false; return true; } public static void main(String[] args) { new TicTac().run(); } public void run() { final String className = this.getClass().getName().toLowerCase(); try { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); rnd = new Random(); solve(); out.close(); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } private String nextToken() throws IOException { while (st == null || !st.hasMoreTokens()) { String line = in.readLine(); if (line == null) return null; st = new StringTokenizer(line); } return st.nextToken(); } private int nextInt() throws IOException { return Integer.parseInt(nextToken()); } private long nextLong() throws IOException { return Long.parseLong(nextToken()); } private double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } }
अंतर खोजें