Created
December 22, 2015 02:04
-
-
Save peter279k/1c2d1599429048826fa3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class main{ | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
int numbers = input.nextInt(); | |
for(int i=1;i<=numbers;i++) { | |
int x = input.nextInt(); | |
int y = input.nextInt(); | |
int x_add_y = x + y; | |
if(x_add_y % 2 != 0) { | |
System.out.println("impossible"); | |
continue; | |
} | |
int x_ans = (x_add_y) / 2; | |
int y_ans = x - x_ans; | |
if(x_ans < 0 || y_ans < 0) | |
System.out.println("impossible"); | |
else | |
System.out.println(x_ans + " " + y_ans); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment