1.

import java.util.Scanner;


public class Main {

/**
* Angewandte Mathematik, SS11
* Problem: 10812 - Beat the Spread!
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=20&page=show_problem&problem=1753
*
* @author Pirmin Schneider
* @author Peter Weis
* @version 1.0, 04/19/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.168
*/

public static void main(String[] args) {

// a + b = sum
// a - b = diff

int sum;
int diff;

int a;
int b;

Scanner sc = new Scanner(System.in);
int j = sc.nextInt();

for(int i=0; i<j; i++) {
sum = sc.nextInt();
diff = sc.nextInt();

// Summe kann nicht kleiner sein als die Differenz
if (sum < diff) System.out.println("impossible");

// Summe und Differenz müssen entweder beide gerade, oder ungerade sein, da bei zwei Mannschaften
// das Ergebnis sonst keine ganze Zahl sein kann
else if ((sum-diff) % 2 != 0) System.out.println("impossible");

else {
b = (sum - diff) / 2;
a = sum - b;
System.out.println(a+" "+b);
}
}

}

}


--------------------------------------------------------------------------------------------

1.
/** * FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* * Problem: 10812 - Beat the Spread!
* * Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=20&page=show_problem&problem=1753
* * Savkina Ekaterina
* * @version 1.0, 29/04/2010
* * Status : Accepted
* * Runtime: 0.152 */
package Scores;

import java.util.Scanner;

public class Scores {
public static void main(String... args) {
Scanner sc = new Scanner(System.in);
int countCase = sc.nextInt();
int a, b;
int sum;
int diff;
for (int i = 1; i <= countCase; i++) {
a = sc.nextInt();
b = sc.nextInt();
sum = a + b;
diff = a - b;
if (a >= b) {
if ((sum % 2 == 0) && (diff % 2 == 0)) {
System.out.println((a + b) / 2 + " " + (a - b) / 2);
} else
System.out.println("impossible");
} else
System.out.println("impossible");
}
}
}