import java.io.*;
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);
int cases=TextIO.getInt();
for(int i=0;i<cases;i++){
int x=TextIO.getInt();
int y=TextIO.getInt();
if(x<y ||(x+y)%2!=0)
System.out.println("impossible");
else{
int num1,num2;
num1=(x+y)/2;
num2=(x-y)/2;
System.out.println(Math.max(num1, num2)+" "+Math.min(num1, num2));
}
}
}
}
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);
int cases=TextIO.getInt();
for(int i=0;i<cases;i++){
int x=TextIO.getInt();
int y=TextIO.getInt();
if(x<y ||(x+y)%2!=0)
System.out.println("impossible");
else{
int num1,num2;
num1=(x+y)/2;
num2=(x-y)/2;
System.out.println(Math.max(num1, num2)+" "+Math.min(num1, num2));
}
}
}
}
No comments:
Post a Comment