import java.io.*;
import java.util.Arrays;
import java.util.IllegalFormatException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
public class Main{
public static void main(String[] args) throws FileNotFoundException {
TextIO.readStream(System.in);
while (true){
int x1=TextIO.getInt(),y1=TextIO.getInt(),x2=TextIO.getInt(),y2=TextIO.getInt();
if(x1==0 && x2==0 && y1==0 && y2==0)
break;
if(x1==x2 && y1==y2)
System.out.println("0");
else if(x1==x2 || y1==y2 || Math.abs(x2-x1)==Math.abs(y2-y1)){
System.out.println("1");
}
else
System.out.println("2");
}
}
}
import java.util.Arrays;
import java.util.IllegalFormatException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
public class Main{
public static void main(String[] args) throws FileNotFoundException {
TextIO.readStream(System.in);
while (true){
int x1=TextIO.getInt(),y1=TextIO.getInt(),x2=TextIO.getInt(),y2=TextIO.getInt();
if(x1==0 && x2==0 && y1==0 && y2==0)
break;
if(x1==x2 && y1==y2)
System.out.println("0");
else if(x1==x2 || y1==y2 || Math.abs(x2-x1)==Math.abs(y2-y1)){
System.out.println("1");
}
else
System.out.println("2");
}
}
}
No comments:
Post a Comment