Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //10812 - Beat the Spread!
- import java.util.*;
- public class HW11_3A617100_10812 {
- public static void main(String[] args) {
- Scanner sc = new Scanner (System.in);
- int data = sc.nextInt();//幾筆
- for(int i = 0 ; i < data ; i++) {
- int sum = sc.nextInt();//分數總和
- int dif = sc.nextInt();//分數差
- int a,b;//ans
- if(sum%2==0 & dif%2 ==0 & sum>dif ) {
- //a+b=sum a-b=dif 2a=sum+dif
- a = (sum+dif)/2;
- b = sum - a;
- System.out.print(a+" "+b);
- }else {
- System.out.print("impossible");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement